<?xml version="1.0"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html><head><title>SASAPI</title><script src="../../quicknav.js" type="text/javascript"></script><script><!--
document.quicknavBasePath="../../index-files";
//--></script><link href="../../style.css" title="JavaDoc" rel="stylesheet" type="text/css"/><link href="../../unnatural.css" title="Unnatural" rel="alternate stylesheet" type="text/css"/><link href="../../overview-summary.html" title="Overview" rel="top"/><meta name="generator" content="http://www.badgers-in-foil.co.uk/projects/as2api/"/></head><body><pre><span class="lineno" id="1">     1  </span><span class="comment doc">/**
<span class="lineno" id="2">     2  </span> * Tweener
<span class="lineno" id="3">     3  </span> * Transition controller for movieclips, sounds, textfields and other objects
<span class="lineno" id="4">     4  </span> *
<span class="lineno" id="5">     5  </span> * @author		Zeh Fernando, Nate Chatellier, Arthur Debert
<span class="lineno" id="6">     6  </span> * @version		1.31.69
<span class="lineno" id="7">     7  </span> */</span>
<span class="lineno" id="8">     8  </span>
<span class="lineno" id="9">     9  </span><span class="comment">/*
<span class="lineno" id="10">    10  </span>Licensed under the MIT License
<span class="lineno" id="11">    11  </span>
<span class="lineno" id="12">    12  </span>Copyright (c) 2006-2007 Zeh Fernando, Nate Chatellier and Arthur Debert
<span class="lineno" id="13">    13  </span>
<span class="lineno" id="14">    14  </span>Permission is hereby granted, free of charge, to any person obtaining a copy of
<span class="lineno" id="15">    15  </span>this software and associated documentation files (the "Software"), to deal in
<span class="lineno" id="16">    16  </span>the Software without restriction, including without limitation the rights to
<span class="lineno" id="17">    17  </span>use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
<span class="lineno" id="18">    18  </span>the Software, and to permit persons to whom the Software is furnished to do so,
<span class="lineno" id="19">    19  </span>subject to the following conditions:
<span class="lineno" id="20">    20  </span>
<span class="lineno" id="21">    21  </span>The above copyright notice and this permission notice shall be included in all
<span class="lineno" id="22">    22  </span>copies or substantial portions of the Software.
<span class="lineno" id="23">    23  </span>
<span class="lineno" id="24">    24  </span>THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
<span class="lineno" id="25">    25  </span>IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
<span class="lineno" id="26">    26  </span>FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
<span class="lineno" id="27">    27  </span>COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
<span class="lineno" id="28">    28  </span>IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
<span class="lineno" id="29">    29  </span>CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
<span class="lineno" id="30">    30  </span>
<span class="lineno" id="31">    31  </span>http://code.google.com/p/tweener/
<span class="lineno" id="32">    32  </span>http://code.google.com/p/tweener/wiki/License
<span class="lineno" id="33">    33  </span>*/</span>
<span class="lineno" id="34">    34  </span>
<span class="lineno" id="35">    35  </span><span class="key">import</span> caurina.transitions.Equations;
<span class="lineno" id="36">    36  </span><span class="key">import</span> caurina.transitions.AuxFunctions;
<span class="lineno" id="37">    37  </span><span class="key">import</span> caurina.transitions.SpecialProperty;
<span class="lineno" id="38">    38  </span><span class="key">import</span> caurina.transitions.SpecialPropertyModifier;
<span class="lineno" id="39">    39  </span><span class="key">import</span> caurina.transitions.SpecialPropertySplitter;
<span class="lineno" id="40">    40  </span><span class="key">import</span> caurina.transitions.TweenListObj;
<span class="lineno" id="41">    41  </span><span class="key">import</span> caurina.transitions.PropertyInfoObj;
<span class="lineno" id="42">    42  </span>
<span class="lineno" id="43">    43  </span><span class="key">class</span> caurina.transitions.Tweener {
<span class="lineno" id="44">    44  </span>
<span class="lineno" id="45">    45  </span>	<span class="key">private</span> <span class="key">static</span> <span class="key">var</span> _engineExists:Boolean = <span class="key">false</span>;		<span class="comment">// Whether or not the engine is currently running</span>
<span class="lineno" id="46">    46  </span>	<span class="key">private</span> <span class="key">static</span> <span class="key">var</span> _inited:Boolean = <span class="key">false</span>;				<span class="comment">// Whether or not the class has been initiated</span>
<span class="lineno" id="47">    47  </span>	<span class="key">private</span> <span class="key">static</span> <span class="key">var</span> _currentTime:Number;					<span class="comment">// The current time. This is generic for all tweenings for a "time grid" based update</span>
<span class="lineno" id="48">    48  </span>	<span class="key">private</span> <span class="key">static</span> <span class="key">var</span> _currentTimeFrame:Number;			<span class="comment">// The current frame. Used on frame-based tweenings</span>
<span class="lineno" id="49">    49  </span>
<span class="lineno" id="50">    50  </span>	<span class="key">private</span> <span class="key">static</span> <span class="key">var</span> _tweenList:Array;					<span class="comment">// List of active tweens</span>
<span class="lineno" id="51">    51  </span>
<span class="lineno" id="52">    52  </span>	<span class="key">private</span> <span class="key">static</span> <span class="key">var</span> _timeScale:Number = <span class="num_const">1</span>;				<span class="comment">// Time scale (default = 1)</span>
<span class="lineno" id="53">    53  </span>
<span class="lineno" id="54">    54  </span>	<span class="key">private</span> <span class="key">static</span> <span class="key">var</span> _transitionList:Object;				<span class="comment">// List of "pre-fetched" transition functions</span>
<span class="lineno" id="55">    55  </span>	<span class="key">private</span> <span class="key">static</span> <span class="key">var</span> _specialPropertyList:Object;			<span class="comment">// List of special properties</span>
<span class="lineno" id="56">    56  </span>	<span class="key">private</span> <span class="key">static</span> <span class="key">var</span> _specialPropertyModifierList:Object;	<span class="comment">// List of special property modifiers</span>
<span class="lineno" id="57">    57  </span>	<span class="key">private</span> <span class="key">static</span> <span class="key">var</span> _specialPropertySplitterList:Object;	<span class="comment">// List of special property splitters</span>
<span class="lineno" id="58">    58  </span>
<span class="lineno" id="59">    59  </span>
<span class="lineno" id="60">    60  </span>	<span class="comment doc">/**
<span class="lineno" id="61">    61  </span>	 * There's no constructor.
<span class="lineno" id="62">    62  </span>	 */</span>
<span class="lineno" id="63">    63  </span>	<span class="key">public</span> <span class="key">function</span> Tweener () {
<span class="lineno" id="64">    64  </span>		trace (<span class="str_const">"Tweener is an static class and should not be instantiated."</span>);
<span class="lineno" id="65">    65  </span>	}
<span class="lineno" id="66">    66  </span>
<span class="lineno" id="67">    67  </span>
<span class="lineno" id="68">    68  </span>	<span class="comment">// ==================================================================================================================================</span>
<span class="lineno" id="69">    69  </span>	<span class="comment">// TWEENING CONTROL functions -------------------------------------------------------------------------------------------------------</span>
<span class="lineno" id="70">    70  </span>
<span class="lineno" id="71">    71  </span>	<span class="comment doc">/**
<span class="lineno" id="72">    72  </span>	 * Adds a new tweening
<span class="lineno" id="73">    73  </span>	 *
<span class="lineno" id="74">    74  </span>	 * @param		(first-n param)		Object				Object that should be tweened: a movieclip, textfield, etc.. OR an array of objects
<span class="lineno" id="75">    75  </span>	 * @param		(last param)		Object				Object containing the specified parameters in any order, as well as the properties that should be tweened and their values
<span class="lineno" id="76">    76  </span>	 * @param		.time				Number				Time in seconds or frames for the tweening to take (defaults 2)
<span class="lineno" id="77">    77  </span>	 * @param		.delay				Number				Delay time (defaults 0)
<span class="lineno" id="78">    78  </span>	 * @param		.useFrames			Boolean				Whether to use frames instead of seconds for time control (defaults false)
<span class="lineno" id="79">    79  </span>	 * @param		.transition			String/Function		Type of transition equation... (defaults to "easeoutexpo")
<span class="lineno" id="80">    80  </span>	 * @param		.transitionParams	Object				* Direct property, See the TweenListObj class
<span class="lineno" id="81">    81  </span>	 * @param		.onStart			Function			* Direct property, See the TweenListObj class
<span class="lineno" id="82">    82  </span>	 * @param		.onUpdate			Function			* Direct property, See the TweenListObj class
<span class="lineno" id="83">    83  </span>	 * @param		.onComplete			Function			* Direct property, See the TweenListObj class
<span class="lineno" id="84">    84  </span>	 * @param		.onOverwrite		Function			* Direct property, See the TweenListObj class
<span class="lineno" id="85">    85  </span>	 * @param		.onStartParams		Array				* Direct property, See the TweenListObj class
<span class="lineno" id="86">    86  </span>	 * @param		.onUpdateParams		Array				* Direct property, See the TweenListObj class
<span class="lineno" id="87">    87  </span>	 * @param		.onCompleteParams	Array				* Direct property, See the TweenListObj class
<span class="lineno" id="88">    88  </span>	 * @param		.onOverwriteParams	Array				* Direct property, See the TweenListObj class
<span class="lineno" id="89">    89  </span>	 * @param		.rounded			Boolean				* Direct property, See the TweenListObj class
<span class="lineno" id="90">    90  </span>	 * @param		.skipUpdates		Number				* Direct property, See the TweenListObj class
<span class="lineno" id="91">    91  </span>	 * @return							Boolean				TRUE if the tween was successfully added, FALSE if otherwise
<span class="lineno" id="92">    92  </span>	 */</span>
<span class="lineno" id="93">    93  </span>	<span class="key">public</span> <span class="key">static</span> <span class="key">function</span> addTween (p_scopes:Object, p_parameters:Object):Boolean {
<span class="lineno" id="94">    94  </span>		<span class="key">if</span> (p_scopes == undefined) <span class="key">return</span> <span class="key">false</span>;
<span class="lineno" id="95">    95  </span>
<span class="lineno" id="96">    96  </span>		<span class="key">var</span> i:Number, j:Number, istr:String;
<span class="lineno" id="97">    97  </span>
<span class="lineno" id="98">    98  </span>		<span class="key">var</span> rScopes:Array; <span class="comment">// List of objects to tween</span>
<span class="lineno" id="99">    99  </span>		<span class="key">if</span> (p_scopes <span class="key">instanceof</span> Array) {
<span class="lineno" id="100">   100  </span>			<span class="comment">// The first argument is an array</span>
<span class="lineno" id="101">   101  </span>			rScopes = p_scopes.concat();
<span class="lineno" id="102">   102  </span>		} <span class="key">else</span> {
<span class="lineno" id="103">   103  </span>			<span class="comment">// The first argument(s) is(are) object(s)</span>
<span class="lineno" id="104">   104  </span>			rScopes = [p_scopes];
<span class="lineno" id="105">   105  </span>		}
<span class="lineno" id="106">   106  </span>
<span class="lineno" id="107">   107  </span>        <span class="comment">// make properties chain ("inheritance")</span>
<span class="lineno" id="108">   108  </span>		<span class="key">var</span> p_obj:Object = TweenListObj.makePropertiesChain(p_parameters);
<span class="lineno" id="109">   109  </span>
<span class="lineno" id="110">   110  </span>		<span class="comment">// Creates the main engine if it isn't active</span>
<span class="lineno" id="111">   111  </span>		<span class="key">if</span> (!_inited) init();
<span class="lineno" id="112">   112  </span>		<span class="key">if</span> (!_engineExists || _root[getControllerName()] == undefined) startEngine(); <span class="comment">// Quick fix for Flash not resetting the vars on double ctrl+enter...</span>
<span class="lineno" id="113">   113  </span>
<span class="lineno" id="114">   114  </span>		<span class="comment">// Creates a "safer", more strict tweening object</span>
<span class="lineno" id="115">   115  </span>		<span class="key">var</span> rTime:Number = (isNaN(p_obj.time) ? <span class="num_const">0</span> : p_obj.time); <span class="comment">// Real time</span>
<span class="lineno" id="116">   116  </span>		<span class="key">var</span> rDelay:Number = (isNaN(p_obj.delay) ? <span class="num_const">0</span> : p_obj.delay); <span class="comment">// Real delay</span>
<span class="lineno" id="117">   117  </span>
<span class="lineno" id="118">   118  </span>		<span class="comment">// Creates the property list; everything that isn't a hardcoded variable</span>
<span class="lineno" id="119">   119  </span>		<span class="key">var</span> rProperties:Object = <span class="key">new</span> Object(); <span class="comment">// Object containing a list of PropertyInfoObj instances</span>
<span class="lineno" id="120">   120  </span>		<span class="key">var</span> restrictedWords:Object = {time:<span class="key">true</span>, delay:<span class="key">true</span>, useFrames:<span class="key">true</span>, skipUpdates:<span class="key">true</span>, transition:<span class="key">true</span>, transitionParams:<span class="key">true</span>, onStart:<span class="key">true</span>, onUpdate:<span class="key">true</span>, onComplete:<span class="key">true</span>, onOverwrite:<span class="key">true</span>, onError:<span class="key">true</span>, rounded:<span class="key">true</span>, onStartParams:<span class="key">true</span>, onUpdateParams:<span class="key">true</span>, onCompleteParams:<span class="key">true</span>, onOverwriteParams:<span class="key">true</span>, onStartScope:<span class="key">true</span>, onUpdateScope:<span class="key">true</span>, onCompleteScope:<span class="key">true</span>, onOverwriteScope:<span class="key">true</span>, onErrorScope:<span class="key">true</span>, quickAdd:<span class="key">true</span>};
<span class="lineno" id="121">   121  </span>		<span class="key">var</span> modifiedProperties:Object = <span class="key">new</span> Object();
<span class="lineno" id="122">   122  </span>		<span class="key">for</span> (istr <span class="key">in</span> p_obj) {
<span class="lineno" id="123">   123  </span>			<span class="key">if</span> (!restrictedWords[istr]) {
<span class="lineno" id="124">   124  </span>				<span class="comment">// It's an additional pair, so adds</span>
<span class="lineno" id="125">   125  </span>				<span class="key">if</span> (_specialPropertySplitterList[istr] != undefined) {
<span class="lineno" id="126">   126  </span>					<span class="comment">// Special property splitter</span>
<span class="lineno" id="127">   127  </span>					<span class="key">var</span> splitProperties:Array = _specialPropertySplitterList[istr].splitValues(p_obj[istr], _specialPropertySplitterList[istr].parameters);
<span class="lineno" id="128">   128  </span>					<span class="key">for</span> (i = <span class="num_const">0</span>; i &lt; splitProperties.length; i++) {
<span class="lineno" id="129">   129  </span>						<span class="key">if</span> (_specialPropertySplitterList[splitProperties[i].name] != undefined) {
<span class="lineno" id="130">   130  </span>							<span class="key">var</span> splitProperties2:Array = _specialPropertySplitterList[splitProperties[i].name].splitValues(splitProperties[i].value, _specialPropertySplitterList[splitProperties[i].name].parameters);
<span class="lineno" id="131">   131  </span>							<span class="key">for</span> (j = <span class="num_const">0</span>; j &lt; splitProperties2.length; j++) {
<span class="lineno" id="132">   132  </span>								rProperties[splitProperties2[j].name] = {valueStart:undefined, valueComplete:splitProperties2[j].value, arrayIndex:splitProperties2[j].arrayIndex, isSpecialProperty:<span class="key">false</span>};
<span class="lineno" id="133">   133  </span>							}
<span class="lineno" id="134">   134  </span>						} <span class="key">else</span> {
<span class="lineno" id="135">   135  </span>							rProperties[splitProperties[i].name] = {valueStart:undefined, valueComplete:splitProperties[i].value, arrayIndex:splitProperties[i].arrayIndex, isSpecialProperty:<span class="key">false</span>};
<span class="lineno" id="136">   136  </span>						}
<span class="lineno" id="137">   137  </span>					}
<span class="lineno" id="138">   138  </span>				} <span class="key">else</span> <span class="key">if</span> (_specialPropertyModifierList[istr] != undefined) {
<span class="lineno" id="139">   139  </span>					<span class="comment">// Special property modifier</span>
<span class="lineno" id="140">   140  </span>					<span class="key">var</span> tempModifiedProperties:Array = _specialPropertyModifierList[istr].modifyValues(p_obj[istr]);
<span class="lineno" id="141">   141  </span>					<span class="key">for</span> (i = <span class="num_const">0</span>; i &lt; tempModifiedProperties.length; i++) {
<span class="lineno" id="142">   142  </span>						modifiedProperties[tempModifiedProperties[i].name] = {modifierParameters:tempModifiedProperties[i].parameters, modifierFunction:_specialPropertyModifierList[istr].getValue};
<span class="lineno" id="143">   143  </span>					}
<span class="lineno" id="144">   144  </span>				} <span class="key">else</span> {
<span class="lineno" id="145">   145  </span>					<span class="comment">// Regular property or special property, just add the property normally</span>
<span class="lineno" id="146">   146  </span>					rProperties[istr] = {valueStart:undefined, valueComplete:p_obj[istr]};
<span class="lineno" id="147">   147  </span>				}
<span class="lineno" id="148">   148  </span>			}
<span class="lineno" id="149">   149  </span>		}
<span class="lineno" id="150">   150  </span>
<span class="lineno" id="151">   151  </span>		<span class="comment">// Verifies whether the properties exist or not, for warning messages</span>
<span class="lineno" id="152">   152  </span>		<span class="key">for</span> (istr <span class="key">in</span> rProperties) {
<span class="lineno" id="153">   153  </span>			<span class="key">if</span> (_specialPropertyList[istr] != undefined) {
<span class="lineno" id="154">   154  </span>				rProperties[istr].isSpecialProperty = <span class="key">true</span>;
<span class="lineno" id="155">   155  </span>			} <span class="key">else</span> {
<span class="lineno" id="156">   156  </span>				<span class="key">if</span> (rScopes[<span class="num_const">0</span>][istr] == undefined) {
<span class="lineno" id="157">   157  </span>					printError(<span class="str_const">"The property '"</span> + istr + <span class="str_const">"' doesn't seem to be a normal object property of "</span> + rScopes[<span class="num_const">0</span>].toString() + <span class="str_const">" or a registered special property."</span>);
<span class="lineno" id="158">   158  </span>				}
<span class="lineno" id="159">   159  </span>			}
<span class="lineno" id="160">   160  </span>		}
<span class="lineno" id="161">   161  </span>
<span class="lineno" id="162">   162  </span>		<span class="comment">// Adds the modifiers to the list of properties</span>
<span class="lineno" id="163">   163  </span>		<span class="key">for</span> (istr <span class="key">in</span> modifiedProperties) {
<span class="lineno" id="164">   164  </span>			<span class="key">if</span> (rProperties[istr] != undefined) {
<span class="lineno" id="165">   165  </span>				rProperties[istr].modifierParameters = modifiedProperties[istr].modifierParameters;
<span class="lineno" id="166">   166  </span>				rProperties[istr].modifierFunction = modifiedProperties[istr].modifierFunction;
<span class="lineno" id="167">   167  </span>			}
<span class="lineno" id="168">   168  </span>			
<span class="lineno" id="169">   169  </span>		}
<span class="lineno" id="170">   170  </span>		
<span class="lineno" id="171">   171  </span>		<span class="key">var</span> rTransition:Function; <span class="comment">// Real transition</span>
<span class="lineno" id="172">   172  </span>
<span class="lineno" id="173">   173  </span>		<span class="key">if</span> (<span class="key">typeof</span> p_obj.transition == <span class="str_const">"string"</span>) {
<span class="lineno" id="174">   174  </span>			<span class="comment">// String parameter, transition names</span>
<span class="lineno" id="175">   175  </span>			<span class="key">var</span> trans:String = p_obj.transition.toLowerCase();
<span class="lineno" id="176">   176  </span>			rTransition = _transitionList[trans];
<span class="lineno" id="177">   177  </span>		} <span class="key">else</span> {
<span class="lineno" id="178">   178  </span>			<span class="comment">// Proper transition function</span>
<span class="lineno" id="179">   179  </span>			rTransition = p_obj.transition;
<span class="lineno" id="180">   180  </span>		}
<span class="lineno" id="181">   181  </span>		<span class="key">if</span> (rTransition == undefined) rTransition = _transitionList[<span class="str_const">"easeoutexpo"</span>];
<span class="lineno" id="182">   182  </span>
<span class="lineno" id="183">   183  </span>		<span class="key">var</span> nProperties:Object;
<span class="lineno" id="184">   184  </span>		<span class="key">var</span> nTween:TweenListObj;
<span class="lineno" id="185">   185  </span>		<span class="key">var</span> myT:Number;
<span class="lineno" id="186">   186  </span>
<span class="lineno" id="187">   187  </span>		<span class="key">for</span> (i = <span class="num_const">0</span>; i &lt; rScopes.length; i++) {
<span class="lineno" id="188">   188  </span>			<span class="comment">// Makes a copy of the properties</span>
<span class="lineno" id="189">   189  </span>			nProperties = <span class="key">new</span> Object();
<span class="lineno" id="190">   190  </span>			<span class="key">for</span> (istr <span class="key">in</span> rProperties) {
<span class="lineno" id="191">   191  </span>				nProperties[istr] = <span class="key">new</span> PropertyInfoObj(rProperties[istr].valueStart, rProperties[istr].valueComplete, rProperties[istr].valueComplete, rProperties[istr].arrayIndex, {}, rProperties[istr].isSpecialProperty, rProperties[istr].modifierFunction, rProperties[istr].modifierParameters);
<span class="lineno" id="192">   192  </span>			}
<span class="lineno" id="193">   193  </span>
<span class="lineno" id="194">   194  </span>			<span class="key">if</span> (p_obj.useFrames == <span class="key">true</span>) {
<span class="lineno" id="195">   195  </span>				nTween = <span class="key">new</span> TweenListObj(
<span class="lineno" id="196">   196  </span>					<span class="comment">/* scope			*/</span>	rScopes[i],
<span class="lineno" id="197">   197  </span>					<span class="comment">/* timeStart		*/</span>	_currentTimeFrame + (rDelay / _timeScale),
<span class="lineno" id="198">   198  </span>					<span class="comment">/* timeComplete		*/</span>	_currentTimeFrame + ((rDelay + rTime) / _timeScale),
<span class="lineno" id="199">   199  </span>					<span class="comment">/* useFrames		*/</span>	<span class="key">true</span>,
<span class="lineno" id="200">   200  </span>					<span class="comment">/* transition		*/</span>	rTransition,
<span class="lineno" id="201">   201  </span>											p_obj.transitionParams
<span class="lineno" id="202">   202  </span>				);
<span class="lineno" id="203">   203  </span>			} <span class="key">else</span> {
<span class="lineno" id="204">   204  </span>				nTween = <span class="key">new</span> TweenListObj(
<span class="lineno" id="205">   205  </span>					<span class="comment">/* scope			*/</span>	rScopes[i],
<span class="lineno" id="206">   206  </span>					<span class="comment">/* timeStart		*/</span>	_currentTime + ((rDelay * <span class="num_const">1000</span>) / _timeScale),
<span class="lineno" id="207">   207  </span>					<span class="comment">/* timeComplete		*/</span>	_currentTime + (((rDelay * <span class="num_const">1000</span>) + (rTime * <span class="num_const">1000</span>)) / _timeScale),
<span class="lineno" id="208">   208  </span>					<span class="comment">/* useFrames		*/</span>	<span class="key">false</span>,
<span class="lineno" id="209">   209  </span>					<span class="comment">/* transition		*/</span>	rTransition,
<span class="lineno" id="210">   210  </span>											p_obj.transitionParams
<span class="lineno" id="211">   211  </span>				);
<span class="lineno" id="212">   212  </span>			}
<span class="lineno" id="213">   213  </span>
<span class="lineno" id="214">   214  </span>			nTween.properties			=	nProperties;
<span class="lineno" id="215">   215  </span>			nTween.onStart				=	p_obj.onStart;
<span class="lineno" id="216">   216  </span>			nTween.onUpdate				=	p_obj.onUpdate;
<span class="lineno" id="217">   217  </span>			nTween.onComplete			=	p_obj.onComplete;
<span class="lineno" id="218">   218  </span>			nTween.onOverwrite			=	p_obj.onOverwrite;
<span class="lineno" id="219">   219  </span>			nTween.onError              =   p_obj.onError;
<span class="lineno" id="220">   220  </span>			nTween.onStartParams		=	p_obj.onStartParams;
<span class="lineno" id="221">   221  </span>			nTween.onUpdateParams		=	p_obj.onUpdateParams;
<span class="lineno" id="222">   222  </span>			nTween.onCompleteParams		=	p_obj.onCompleteParams;
<span class="lineno" id="223">   223  </span>			nTween.onOverwriteParams	=	p_obj.onOverwriteParams;
<span class="lineno" id="224">   224  </span>			nTween.onStartScope			=	p_obj.onStartScope;
<span class="lineno" id="225">   225  </span>			nTween.onUpdateScope		=	p_obj.onUpdateScope;
<span class="lineno" id="226">   226  </span>			nTween.onCompleteScope		=	p_obj.onCompleteScope;
<span class="lineno" id="227">   227  </span>			nTween.onOverwriteScope		=	p_obj.onOverwriteScope;
<span class="lineno" id="228">   228  </span>			nTween.onErrorScope			=	p_obj.onErrorScope;
<span class="lineno" id="229">   229  </span>			nTween.rounded				=	p_obj.rounded;
<span class="lineno" id="230">   230  </span>			nTween.skipUpdates			=	p_obj.skipUpdates;
<span class="lineno" id="231">   231  </span>
<span class="lineno" id="232">   232  </span>			<span class="comment">// Remove other tweenings that occur at the same time</span>
<span class="lineno" id="233">   233  </span>			<span class="key">if</span> (!p_obj.quickAdd) removeTweensByTime(nTween.scope, nTween.properties, nTween.timeStart, nTween.timeComplete);
<span class="lineno" id="234">   234  </span>
<span class="lineno" id="235">   235  </span>			<span class="comment">// And finally adds it to the list</span>
<span class="lineno" id="236">   236  </span>			_tweenList.push(nTween);
<span class="lineno" id="237">   237  </span>
<span class="lineno" id="238">   238  </span>			<span class="comment">// Immediate update and removal if it's an immediate tween -- if not deleted, it executes at the end of this frame execution</span>
<span class="lineno" id="239">   239  </span>			<span class="key">if</span> (rTime == <span class="num_const">0</span> &amp;&amp; rDelay == <span class="num_const">0</span>) {
<span class="lineno" id="240">   240  </span>				myT = _tweenList.length-<span class="num_const">1</span>;
<span class="lineno" id="241">   241  </span>				updateTweenByIndex(myT);
<span class="lineno" id="242">   242  </span>				removeTweenByIndex(myT);
<span class="lineno" id="243">   243  </span>			}
<span class="lineno" id="244">   244  </span>		}
<span class="lineno" id="245">   245  </span>
<span class="lineno" id="246">   246  </span>		<span class="key">return</span> <span class="key">true</span>;
<span class="lineno" id="247">   247  </span>	}
<span class="lineno" id="248">   248  </span>
<span class="lineno" id="249">   249  </span>	<span class="comment">// A "caller" is like this: [          |     |  | ||] got it? :)</span>
<span class="lineno" id="250">   250  </span>	<span class="comment">// this function is crap - should be fixed later/extend on addTween()</span>
<span class="lineno" id="251">   251  </span>
<span class="lineno" id="252">   252  </span>	<span class="comment doc">/**
<span class="lineno" id="253">   253  </span>	 * Adds a new *caller* tweening
<span class="lineno" id="254">   254  </span>	 *
<span class="lineno" id="255">   255  </span>	 * @param		(first-n param)		Object				Object that should be tweened: a movieclip, textfield, etc.. OR an array of objects
<span class="lineno" id="256">   256  </span>	 * @param		(last param)		Object				Object containing the specified parameters in any order, as well as the properties that should be tweened and their values
<span class="lineno" id="257">   257  </span>	 * @param		.time				Number				Time in seconds or frames for the tweening to take (defaults 2)
<span class="lineno" id="258">   258  </span>	 * @param		.delay				Number				Delay time (defaults 0)
<span class="lineno" id="259">   259  </span>	 * @param		.count				Number				Number of times this caller should be called
<span class="lineno" id="260">   260  </span>	 * @param		.transition			String/Function		Type of transition equation... (defaults to "easeoutexpo")
<span class="lineno" id="261">   261  </span>	 * @param		.onStart			Function			Event called when tween starts
<span class="lineno" id="262">   262  </span>	 * @param		.onUpdate			Function			Event called when tween updates
<span class="lineno" id="263">   263  </span>	 * @param		.onComplete			Function			Event called when tween ends
<span class="lineno" id="264">   264  </span>	 * @param		.waitFrames			Boolean				Whether to wait (or not) one frame for each call
<span class="lineno" id="265">   265  </span>	 * @return							Boolean				TRUE if the tween was successfully added, FALSE if otherwise
<span class="lineno" id="266">   266  </span>	 */</span>
<span class="lineno" id="267">   267  </span>	<span class="key">public</span> <span class="key">static</span> <span class="key">function</span> addCaller (p_scopes:Object, p_parameters:Object):Boolean {
<span class="lineno" id="268">   268  </span>		<span class="key">if</span> (p_scopes == undefined) <span class="key">return</span> <span class="key">false</span>;
<span class="lineno" id="269">   269  </span>
<span class="lineno" id="270">   270  </span>		<span class="key">var</span> i:Number;
<span class="lineno" id="271">   271  </span>
<span class="lineno" id="272">   272  </span>		<span class="key">var</span> rScopes:Array; <span class="comment">// List of objects to tween</span>
<span class="lineno" id="273">   273  </span>		<span class="key">if</span> (p_scopes <span class="key">instanceof</span> Array) {
<span class="lineno" id="274">   274  </span>			<span class="comment">// The first argument is an array</span>
<span class="lineno" id="275">   275  </span>			rScopes = p_scopes.concat();
<span class="lineno" id="276">   276  </span>		} <span class="key">else</span> {
<span class="lineno" id="277">   277  </span>			<span class="comment">// The first argument(s) is(are) object(s)</span>
<span class="lineno" id="278">   278  </span>			rScopes = [p_scopes];
<span class="lineno" id="279">   279  </span>		}
<span class="lineno" id="280">   280  </span>
<span class="lineno" id="281">   281  </span>		<span class="key">var</span> p_obj:Object = p_parameters;
<span class="lineno" id="282">   282  </span>
<span class="lineno" id="283">   283  </span>		<span class="comment">// Creates the main engine if it isn't active</span>
<span class="lineno" id="284">   284  </span>		<span class="key">if</span> (!_inited) init();
<span class="lineno" id="285">   285  </span>		<span class="key">if</span> (!_engineExists || _root[getControllerName()] == undefined) startEngine(); <span class="comment">// Quick fix for Flash not resetting the vars on double ctrl+enter...</span>
<span class="lineno" id="286">   286  </span>
<span class="lineno" id="287">   287  </span>		<span class="comment">// Creates a "safer", more strict tweening object</span>
<span class="lineno" id="288">   288  </span>		<span class="key">var</span> rTime:Number = (isNaN(p_obj.time) ? <span class="num_const">0</span> : p_obj.time); <span class="comment">// Real time</span>
<span class="lineno" id="289">   289  </span>		<span class="key">var</span> rDelay:Number = (isNaN(p_obj.delay) ? <span class="num_const">0</span> : p_obj.delay); <span class="comment">// Real delay</span>
<span class="lineno" id="290">   290  </span>
<span class="lineno" id="291">   291  </span>		<span class="key">var</span> rTransition:Function; <span class="comment">// Real transition</span>
<span class="lineno" id="292">   292  </span>		<span class="key">if</span> (<span class="key">typeof</span> p_obj.transition == <span class="str_const">"string"</span>) {
<span class="lineno" id="293">   293  </span>			<span class="comment">// String parameter, transition names</span>
<span class="lineno" id="294">   294  </span>			<span class="key">var</span> trans:String = p_obj.transition.toLowerCase();
<span class="lineno" id="295">   295  </span>			rTransition = _transitionList[trans];
<span class="lineno" id="296">   296  </span>		} <span class="key">else</span> {
<span class="lineno" id="297">   297  </span>			<span class="comment">// Proper transition function</span>
<span class="lineno" id="298">   298  </span>			rTransition = p_obj.transition;
<span class="lineno" id="299">   299  </span>		}
<span class="lineno" id="300">   300  </span>		<span class="key">if</span> (rTransition == undefined) rTransition = _transitionList[<span class="str_const">"easeoutexpo"</span>];
<span class="lineno" id="301">   301  </span>
<span class="lineno" id="302">   302  </span>		<span class="key">var</span> nTween:TweenListObj;
<span class="lineno" id="303">   303  </span>		<span class="key">var</span> myT:Number;
<span class="lineno" id="304">   304  </span>		<span class="key">for</span> (i = <span class="num_const">0</span>; i &lt; rScopes.length; i++) {
<span class="lineno" id="305">   305  </span>
<span class="lineno" id="306">   306  </span>			<span class="key">if</span> (p_obj.useFrames == <span class="key">true</span>) {
<span class="lineno" id="307">   307  </span>				nTween = <span class="key">new</span> TweenListObj(
<span class="lineno" id="308">   308  </span>					<span class="comment">/* scope			*/</span>	rScopes[i],
<span class="lineno" id="309">   309  </span>					<span class="comment">/* timeStart		*/</span>	_currentTimeFrame + (rDelay / _timeScale),
<span class="lineno" id="310">   310  </span>					<span class="comment">/* timeComplete		*/</span>	_currentTimeFrame + ((rDelay + rTime) / _timeScale),
<span class="lineno" id="311">   311  </span>					<span class="comment">/* useFrames		*/</span>	<span class="key">true</span>,
<span class="lineno" id="312">   312  </span>					<span class="comment">/* transition		*/</span>	rTransition,
<span class="lineno" id="313">   313  </span>											p_obj.transitionParams
<span class="lineno" id="314">   314  </span>				);
<span class="lineno" id="315">   315  </span>			} <span class="key">else</span> {
<span class="lineno" id="316">   316  </span>				nTween = <span class="key">new</span> TweenListObj(
<span class="lineno" id="317">   317  </span>					<span class="comment">/* scope			*/</span>	rScopes[i],
<span class="lineno" id="318">   318  </span>					<span class="comment">/* timeStart		*/</span>	_currentTime + ((rDelay * <span class="num_const">1000</span>) / _timeScale),
<span class="lineno" id="319">   319  </span>					<span class="comment">/* timeComplete		*/</span>	_currentTime + (((rDelay * <span class="num_const">1000</span>) + (rTime * <span class="num_const">1000</span>)) / _timeScale),
<span class="lineno" id="320">   320  </span>					<span class="comment">/* useFrames		*/</span>	<span class="key">false</span>,
<span class="lineno" id="321">   321  </span>					<span class="comment">/* transition		*/</span>	rTransition,
<span class="lineno" id="322">   322  </span>											p_obj.transitionParams
<span class="lineno" id="323">   323  </span>				);
<span class="lineno" id="324">   324  </span>			}
<span class="lineno" id="325">   325  </span>
<span class="lineno" id="326">   326  </span>			nTween.properties			=	undefined;
<span class="lineno" id="327">   327  </span>			nTween.onStart				=	p_obj.onStart;
<span class="lineno" id="328">   328  </span>			nTween.onUpdate				=	p_obj.onUpdate;
<span class="lineno" id="329">   329  </span>			nTween.onComplete			=	p_obj.onComplete;
<span class="lineno" id="330">   330  </span>			nTween.onOverwrite			=	p_obj.onOverwrite;
<span class="lineno" id="331">   331  </span>			nTween.onStartParams		=	p_obj.onStartParams;
<span class="lineno" id="332">   332  </span>			nTween.onUpdateParams		=	p_obj.onUpdateParams;
<span class="lineno" id="333">   333  </span>			nTween.onCompleteParams		=	p_obj.onCompleteParams;
<span class="lineno" id="334">   334  </span>			nTween.onOverwriteParams	=	p_obj.onOverwriteParams;
<span class="lineno" id="335">   335  </span>			nTween.onStartScope			=	p_obj.onStartScope;
<span class="lineno" id="336">   336  </span>			nTween.onUpdateScope		=	p_obj.onUpdateScope;
<span class="lineno" id="337">   337  </span>			nTween.onCompleteScope		=	p_obj.onCompleteScope;
<span class="lineno" id="338">   338  </span>			nTween.onOverwriteScope		=	p_obj.onOverwriteScope;
<span class="lineno" id="339">   339  </span>			nTween.onErrorScope			=	p_obj.onErrorScope;
<span class="lineno" id="340">   340  </span>			nTween.isCaller				=	<span class="key">true</span>;
<span class="lineno" id="341">   341  </span>			nTween.count				=	p_obj.count;
<span class="lineno" id="342">   342  </span>			nTween.waitFrames			=	p_obj.waitFrames;
<span class="lineno" id="343">   343  </span>
<span class="lineno" id="344">   344  </span>			<span class="comment">// And finally adds it to the list</span>
<span class="lineno" id="345">   345  </span>			_tweenList.push(nTween);
<span class="lineno" id="346">   346  </span>
<span class="lineno" id="347">   347  </span>			<span class="comment">// Immediate update and removal if it's an immediate tween -- if not deleted, it executes at the end of this frame execution</span>
<span class="lineno" id="348">   348  </span>			<span class="key">if</span> (rTime == <span class="num_const">0</span> &amp;&amp; rDelay == <span class="num_const">0</span>) {
<span class="lineno" id="349">   349  </span>				myT = _tweenList.length-<span class="num_const">1</span>;
<span class="lineno" id="350">   350  </span>				updateTweenByIndex(myT);
<span class="lineno" id="351">   351  </span>				removeTweenByIndex(myT);
<span class="lineno" id="352">   352  </span>			}
<span class="lineno" id="353">   353  </span>		}
<span class="lineno" id="354">   354  </span>
<span class="lineno" id="355">   355  </span>		<span class="key">return</span> <span class="key">true</span>;
<span class="lineno" id="356">   356  </span>	}
<span class="lineno" id="357">   357  </span>
<span class="lineno" id="358">   358  </span>	<span class="comment doc">/**
<span class="lineno" id="359">   359  </span>	 * Remove an specified tweening of a specified object the tweening list, if it conflicts with the given time
<span class="lineno" id="360">   360  </span>	 *
<span class="lineno" id="361">   361  </span>	 * @param		p_scope				Object						List of objects affected
<span class="lineno" id="362">   362  </span>	 * @param		p_properties		Object 						List of properties affected (PropertyInfoObj instances)
<span class="lineno" id="363">   363  </span>	 * @param		p_timeStart			Number						Time when the new tween starts
<span class="lineno" id="364">   364  </span>	 * @param		p_timeComplete		Number						Time when the new tween ends
<span class="lineno" id="365">   365  </span>	 * @return							Boolean						Whether or not it actually deleted something
<span class="lineno" id="366">   366  </span>	 */</span>
<span class="lineno" id="367">   367  </span>	<span class="key">public</span> <span class="key">static</span> <span class="key">function</span> removeTweensByTime (p_scope:Object, p_properties:Object, p_timeStart:Number, p_timeComplete:Number):Boolean {
<span class="lineno" id="368">   368  </span>		<span class="key">var</span> removed:Boolean = <span class="key">false</span>;
<span class="lineno" id="369">   369  </span>		<span class="key">var</span> removedLocally:Boolean;
<span class="lineno" id="370">   370  </span>
<span class="lineno" id="371">   371  </span>		<span class="key">var</span> i:Number;
<span class="lineno" id="372">   372  </span>		<span class="key">var</span> tl:Number = _tweenList.length;
<span class="lineno" id="373">   373  </span>		<span class="key">var</span> pName:String;
<span class="lineno" id="374">   374  </span>
<span class="lineno" id="375">   375  </span>		<span class="key">for</span> (i = <span class="num_const">0</span>; i &lt; tl; i++) {
<span class="lineno" id="376">   376  </span>			<span class="key">if</span> (p_scope == _tweenList[i].scope) {
<span class="lineno" id="377">   377  </span>				<span class="comment">// Same object...</span>
<span class="lineno" id="378">   378  </span>				<span class="key">if</span> (p_timeComplete &gt; _tweenList[i].timeStart &amp;&amp; p_timeStart &lt; _tweenList[i].timeComplete) {
<span class="lineno" id="379">   379  </span>					<span class="comment">// New time should override the old one...</span>
<span class="lineno" id="380">   380  </span>					removedLocally = <span class="key">false</span>;
<span class="lineno" id="381">   381  </span>					<span class="key">for</span> (pName <span class="key">in</span> _tweenList[i].properties) {
<span class="lineno" id="382">   382  </span>						<span class="key">if</span> (p_properties[pName] != undefined) {
<span class="lineno" id="383">   383  </span>							<span class="comment">// Same object, same property</span>
<span class="lineno" id="384">   384  </span>							<span class="comment">// Finally, remove this old tweening and use the new one</span>
<span class="lineno" id="385">   385  </span>							<span class="key">if</span> (_tweenList[i].onOverwrite != undefined) {
<span class="lineno" id="386">   386  </span>								<span class="key">var</span> eventScope:Object = _tweenList[i].onOverwriteScope != undefined ? _tweenList[i].onOverwriteScope : _tweenList[i].scope;
<span class="lineno" id="387">   387  </span>								<span class="key">try</span> {
<span class="lineno" id="388">   388  </span>									_tweenList[i].onOverwrite.apply(eventScope, _tweenList[i].onOverwriteParams);
<span class="lineno" id="389">   389  </span>								} <span class="key">catch</span>(e:Error) {
<span class="lineno" id="390">   390  </span>									handleError(_tweenList[i], e, <span class="str_const">"onOverwrite"</span>);
<span class="lineno" id="391">   391  </span>								}
<span class="lineno" id="392">   392  </span>							}
<span class="lineno" id="393">   393  </span>							_tweenList[i].properties[pName] = undefined;
<span class="lineno" id="394">   394  </span>							<span class="key">delete</span> _tweenList[i].properties[pName];
<span class="lineno" id="395">   395  </span>							removedLocally = <span class="key">true</span>;
<span class="lineno" id="396">   396  </span>							removed = <span class="key">true</span>;
<span class="lineno" id="397">   397  </span>						}
<span class="lineno" id="398">   398  </span>					}
<span class="lineno" id="399">   399  </span>					<span class="key">if</span> (removedLocally) {
<span class="lineno" id="400">   400  </span>						<span class="comment">// Verify if this can be deleted</span>
<span class="lineno" id="401">   401  </span>						<span class="key">if</span> (AuxFunctions.getObjectLength(_tweenList[i].properties) == <span class="num_const">0</span>) removeTweenByIndex(i);
<span class="lineno" id="402">   402  </span>					}
<span class="lineno" id="403">   403  </span>				}
<span class="lineno" id="404">   404  </span>			}
<span class="lineno" id="405">   405  </span>		}
<span class="lineno" id="406">   406  </span>
<span class="lineno" id="407">   407  </span>		<span class="key">return</span> removed;
<span class="lineno" id="408">   408  </span>	}
<span class="lineno" id="409">   409  </span>
<span class="lineno" id="410">   410  </span>	<span class="comment doc">/**
<span class="lineno" id="411">   411  </span>	 * Remove tweenings from a given object from the tweening list
<span class="lineno" id="412">   412  </span>	 *
<span class="lineno" id="413">   413  </span>	 * @param		p_tween				Object		Object that must have its tweens removed
<span class="lineno" id="414">   414  </span>	 * @param		(2nd-last params)	Object		Property(ies) that must be removed
<span class="lineno" id="415">   415  </span>	 * @return							Boolean		Whether or not it successfully removed this tweening
<span class="lineno" id="416">   416  </span>	 */</span>
<span class="lineno" id="417">   417  </span>	<span class="key">public</span> <span class="key">static</span> <span class="key">function</span> removeTweens (p_scope:Object):Boolean {
<span class="lineno" id="418">   418  </span>		<span class="comment">// Create the property list</span>
<span class="lineno" id="419">   419  </span>		<span class="key">var</span> properties:Array = <span class="key">new</span> Array();
<span class="lineno" id="420">   420  </span>		<span class="key">var</span> i:Number;
<span class="lineno" id="421">   421  </span>		<span class="key">for</span> (i = <span class="num_const">1</span>; i &lt; arguments.length; i++) {
<span class="lineno" id="422">   422  </span>			<span class="key">if</span> (<span class="key">typeof</span>(arguments[i]) == <span class="str_const">"string"</span> &amp;&amp; !AuxFunctions.isInArray(arguments[i], properties)) properties.push(arguments[i]);
<span class="lineno" id="423">   423  </span>		}
<span class="lineno" id="424">   424  </span>		<span class="comment">// Call the affect function on the specified properties</span>
<span class="lineno" id="425">   425  </span>		<span class="key">return</span> affectTweens(removeTweenByIndex, p_scope, properties);
<span class="lineno" id="426">   426  </span>	}
<span class="lineno" id="427">   427  </span>
<span class="lineno" id="428">   428  </span>	<span class="comment doc">/**
<span class="lineno" id="429">   429  </span>	 * Remove all tweenings from the engine
<span class="lineno" id="430">   430  </span>	 *
<span class="lineno" id="431">   431  </span>	 * @return							Boolean		Whether or not it successfully removed a tweening
<span class="lineno" id="432">   432  </span>	 */</span>
<span class="lineno" id="433">   433  </span>	<span class="key">public</span> <span class="key">static</span> <span class="key">function</span> removeAllTweens ():Boolean {
<span class="lineno" id="434">   434  </span>		<span class="key">var</span> removed:Boolean = <span class="key">false</span>;
<span class="lineno" id="435">   435  </span>		<span class="key">var</span> i:Number;
<span class="lineno" id="436">   436  </span>		<span class="key">for</span> (i = <span class="num_const">0</span>; i &lt; _tweenList.length; i++) {
<span class="lineno" id="437">   437  </span>			removeTweenByIndex(i);
<span class="lineno" id="438">   438  </span>			removed = <span class="key">true</span>;
<span class="lineno" id="439">   439  </span>		}
<span class="lineno" id="440">   440  </span>		<span class="key">return</span> removed;
<span class="lineno" id="441">   441  </span>	}
<span class="lineno" id="442">   442  </span>
<span class="lineno" id="443">   443  </span>	<span class="comment doc">/**
<span class="lineno" id="444">   444  </span>	 * Pause tweenings from a given object
<span class="lineno" id="445">   445  </span>	 *
<span class="lineno" id="446">   446  </span>	 * @param		p_scope				Object		Object that must have its tweens paused
<span class="lineno" id="447">   447  </span>	 * @param		(2nd-last params)	Object		Property(ies) that must be paused
<span class="lineno" id="448">   448  </span>	 * @return							Boolean		Whether or not it successfully paused something
<span class="lineno" id="449">   449  </span>	 */</span>
<span class="lineno" id="450">   450  </span>	<span class="key">public</span> <span class="key">static</span> <span class="key">function</span> pauseTweens (p_scope:Object):Boolean {
<span class="lineno" id="451">   451  </span>		<span class="comment">// Create the property list</span>
<span class="lineno" id="452">   452  </span>		<span class="key">var</span> properties:Array = <span class="key">new</span> Array();
<span class="lineno" id="453">   453  </span>		<span class="key">var</span> i:Number;
<span class="lineno" id="454">   454  </span>		<span class="key">for</span> (i = <span class="num_const">1</span>; i &lt; arguments.length; i++) {
<span class="lineno" id="455">   455  </span>			<span class="key">if</span> (<span class="key">typeof</span>(arguments[i]) == <span class="str_const">"string"</span> &amp;&amp; !AuxFunctions.isInArray(arguments[i], properties)) properties.push(arguments[i]);
<span class="lineno" id="456">   456  </span>		}
<span class="lineno" id="457">   457  </span>		<span class="comment">// Call the affect function on the specified properties</span>
<span class="lineno" id="458">   458  </span>		<span class="key">return</span> affectTweens(pauseTweenByIndex, p_scope, properties);
<span class="lineno" id="459">   459  </span>	}
<span class="lineno" id="460">   460  </span>
<span class="lineno" id="461">   461  </span>	<span class="comment doc">/**
<span class="lineno" id="462">   462  </span>	 * Pause all tweenings on the engine
<span class="lineno" id="463">   463  </span>	 *
<span class="lineno" id="464">   464  </span>	 * @return							Boolean		Whether or not it successfully paused a tweening
<span class="lineno" id="465">   465  </span>	 */</span>
<span class="lineno" id="466">   466  </span>	<span class="key">public</span> <span class="key">static</span> <span class="key">function</span> pauseAllTweens ():Boolean {
<span class="lineno" id="467">   467  </span>		<span class="key">var</span> paused:Boolean = <span class="key">false</span>;
<span class="lineno" id="468">   468  </span>		<span class="key">var</span> i:Number;
<span class="lineno" id="469">   469  </span>		<span class="key">for</span> (i = <span class="num_const">0</span>; i &lt; _tweenList.length; i++) {
<span class="lineno" id="470">   470  </span>			pauseTweenByIndex(i);
<span class="lineno" id="471">   471  </span>			paused = <span class="key">true</span>;
<span class="lineno" id="472">   472  </span>		}
<span class="lineno" id="473">   473  </span>		<span class="key">return</span> paused;
<span class="lineno" id="474">   474  </span>	}
<span class="lineno" id="475">   475  </span>
<span class="lineno" id="476">   476  </span>	<span class="comment doc">/**
<span class="lineno" id="477">   477  </span>	 * Resume tweenings from a given object
<span class="lineno" id="478">   478  </span>	 *
<span class="lineno" id="479">   479  </span>	 * @param		p_scope				Object		Object that must have its tweens resumed
<span class="lineno" id="480">   480  </span>	 * @param		(2nd-last params)	Object		Property(ies) that must be resumed
<span class="lineno" id="481">   481  </span>	 * @return							Boolean		Whether or not it successfully resumed something
<span class="lineno" id="482">   482  </span>	 */</span>
<span class="lineno" id="483">   483  </span>	<span class="key">public</span> <span class="key">static</span> <span class="key">function</span> resumeTweens (p_scope:Object):Boolean {
<span class="lineno" id="484">   484  </span>		<span class="comment">// Create the property list</span>
<span class="lineno" id="485">   485  </span>		<span class="key">var</span> properties:Array = <span class="key">new</span> Array();
<span class="lineno" id="486">   486  </span>		<span class="key">var</span> i:Number;
<span class="lineno" id="487">   487  </span>		<span class="key">for</span> (i = <span class="num_const">1</span>; i &lt; arguments.length; i++) {
<span class="lineno" id="488">   488  </span>			<span class="key">if</span> (<span class="key">typeof</span>(arguments[i]) == <span class="str_const">"string"</span> &amp;&amp; !AuxFunctions.isInArray(arguments[i], properties)) properties.push(arguments[i]);
<span class="lineno" id="489">   489  </span>		}
<span class="lineno" id="490">   490  </span>		<span class="comment">// Call the affect function on the specified properties</span>
<span class="lineno" id="491">   491  </span>		<span class="key">return</span> affectTweens(resumeTweenByIndex, p_scope, properties);
<span class="lineno" id="492">   492  </span>	}
<span class="lineno" id="493">   493  </span>
<span class="lineno" id="494">   494  </span>	<span class="comment doc">/**
<span class="lineno" id="495">   495  </span>	 * Resume all tweenings on the engine
<span class="lineno" id="496">   496  </span>	 *
<span class="lineno" id="497">   497  </span>	 * @return							Boolean		Whether or not it successfully resumed a tweening
<span class="lineno" id="498">   498  </span>	 */</span>
<span class="lineno" id="499">   499  </span>	<span class="key">public</span> <span class="key">static</span> <span class="key">function</span> resumeAllTweens ():Boolean {
<span class="lineno" id="500">   500  </span>		<span class="key">var</span> resumed:Boolean = <span class="key">false</span>;
<span class="lineno" id="501">   501  </span>		<span class="key">var</span> i:Number;
<span class="lineno" id="502">   502  </span>		<span class="key">for</span> (i = <span class="num_const">0</span>; i &lt; _tweenList.length; i++) {
<span class="lineno" id="503">   503  </span>			resumeTweenByIndex(i);
<span class="lineno" id="504">   504  </span>			resumed = <span class="key">true</span>;
<span class="lineno" id="505">   505  </span>		}
<span class="lineno" id="506">   506  </span>		<span class="key">return</span> resumed;
<span class="lineno" id="507">   507  </span>	}
<span class="lineno" id="508">   508  </span>
<span class="lineno" id="509">   509  </span>	<span class="comment doc">/**
<span class="lineno" id="510">   510  </span>	 * Do some generic action on specific tweenings (pause, resume, remove, more?)
<span class="lineno" id="511">   511  </span>	 *
<span class="lineno" id="512">   512  </span>	 * @param		p_function			Function	Function to run on the tweenings that match
<span class="lineno" id="513">   513  </span>	 * @param		p_scope				Object		Object that must have its tweens affected by the function
<span class="lineno" id="514">   514  </span>	 * @param		p_properties		Array		Array of strings that must be affected
<span class="lineno" id="515">   515  </span>	 * @return							Boolean		Whether or not it successfully affected something
<span class="lineno" id="516">   516  </span>	 */</span>
<span class="lineno" id="517">   517  </span>	<span class="key">private</span> <span class="key">static</span> <span class="key">function</span> affectTweens (p_affectFunction:Function, p_scope:Object, p_properties:Array):Boolean {
<span class="lineno" id="518">   518  </span>		<span class="key">var</span> affected:Boolean = <span class="key">false</span>;
<span class="lineno" id="519">   519  </span>		<span class="key">var</span> i:Number;
<span class="lineno" id="520">   520  </span>
<span class="lineno" id="521">   521  </span>		<span class="key">if</span> (!_tweenList) <span class="key">return</span> <span class="key">false</span>;
<span class="lineno" id="522">   522  </span>
<span class="lineno" id="523">   523  </span>		<span class="key">for</span> (i = <span class="num_const">0</span>; i &lt; _tweenList.length; i++) {
<span class="lineno" id="524">   524  </span>			<span class="key">if</span> (_tweenList[i].scope == p_scope) {
<span class="lineno" id="525">   525  </span>				<span class="key">if</span> (p_properties.length == <span class="num_const">0</span>) {
<span class="lineno" id="526">   526  </span>					<span class="comment">// Can affect everything</span>
<span class="lineno" id="527">   527  </span>					p_affectFunction(i);
<span class="lineno" id="528">   528  </span>					affected = <span class="key">true</span>;
<span class="lineno" id="529">   529  </span>				} <span class="key">else</span> {
<span class="lineno" id="530">   530  </span>					<span class="comment">// Must check whether this tween must have specific properties affected</span>
<span class="lineno" id="531">   531  </span>					<span class="key">var</span> affectedProperties:Array = <span class="key">new</span> Array();
<span class="lineno" id="532">   532  </span>					<span class="key">var</span> j:Number;
<span class="lineno" id="533">   533  </span>					<span class="key">for</span> (j = <span class="num_const">0</span>; j &lt; p_properties.length; j++) {
<span class="lineno" id="534">   534  </span>						<span class="key">if</span> (_tweenList[i].properties[p_properties[j]] != undefined) {
<span class="lineno" id="535">   535  </span>							affectedProperties.push(p_properties[j]);
<span class="lineno" id="536">   536  </span>						}
<span class="lineno" id="537">   537  </span>					}
<span class="lineno" id="538">   538  </span>					<span class="key">if</span> (affectedProperties.length &gt; <span class="num_const">0</span>) {
<span class="lineno" id="539">   539  </span>						<span class="comment">// This tween has some properties that need to be affected</span>
<span class="lineno" id="540">   540  </span>						<span class="key">var</span> objectProperties:Number = AuxFunctions.getObjectLength(_tweenList[i].properties);
<span class="lineno" id="541">   541  </span>						<span class="key">if</span> (objectProperties == affectedProperties.length) {
<span class="lineno" id="542">   542  </span>							<span class="comment">// The list of properties is the same as all properties, so affect it all</span>
<span class="lineno" id="543">   543  </span>							p_affectFunction(i);
<span class="lineno" id="544">   544  </span>							affected = <span class="key">true</span>;
<span class="lineno" id="545">   545  </span>						} <span class="key">else</span> {
<span class="lineno" id="546">   546  </span>							<span class="comment">// The properties are mixed, so split the tween and affect only certain specific properties</span>
<span class="lineno" id="547">   547  </span>							<span class="key">var</span> slicedTweenIndex:Number = splitTweens(i, affectedProperties);
<span class="lineno" id="548">   548  </span>							p_affectFunction(slicedTweenIndex);
<span class="lineno" id="549">   549  </span>							affected = <span class="key">true</span>;
<span class="lineno" id="550">   550  </span>						}
<span class="lineno" id="551">   551  </span>					}
<span class="lineno" id="552">   552  </span>				}
<span class="lineno" id="553">   553  </span>			}
<span class="lineno" id="554">   554  </span>		}
<span class="lineno" id="555">   555  </span>		<span class="key">return</span> affected;
<span class="lineno" id="556">   556  </span>	}
<span class="lineno" id="557">   557  </span>
<span class="lineno" id="558">   558  </span>	<span class="comment doc">/**
<span class="lineno" id="559">   559  </span>	 * Splits a tweening in two
<span class="lineno" id="560">   560  </span>	 *
<span class="lineno" id="561">   561  </span>	 * @param		p_tween				Number		Object that must have its tweens split
<span class="lineno" id="562">   562  </span>	 * @param		p_properties		Array		Array of strings containing the list of properties that must be separated
<span class="lineno" id="563">   563  </span>	 * @return							Number		The index number of the new tween
<span class="lineno" id="564">   564  </span>	 */</span>
<span class="lineno" id="565">   565  </span>	<span class="key">public</span> <span class="key">static</span> <span class="key">function</span> splitTweens (p_tween:Number, p_properties:Array):Number {
<span class="lineno" id="566">   566  </span>		<span class="comment">// First, duplicates</span>
<span class="lineno" id="567">   567  </span>		<span class="key">var</span> originalTween:TweenListObj = _tweenList[p_tween];
<span class="lineno" id="568">   568  </span>		<span class="key">var</span> newTween:TweenListObj = originalTween.clone(<span class="key">false</span>);
<span class="lineno" id="569">   569  </span>
<span class="lineno" id="570">   570  </span>		<span class="comment">// Now, removes tweenings where needed</span>
<span class="lineno" id="571">   571  </span>		<span class="key">var</span> i:Number;
<span class="lineno" id="572">   572  </span>		<span class="key">var</span> pName:String;
<span class="lineno" id="573">   573  </span>
<span class="lineno" id="574">   574  </span>		<span class="comment">// Removes the specified properties from the old one</span>
<span class="lineno" id="575">   575  </span>		<span class="key">for</span> (i = <span class="num_const">0</span>; i &lt; p_properties.length; i++) {
<span class="lineno" id="576">   576  </span>			pName = p_properties[i];
<span class="lineno" id="577">   577  </span>			<span class="key">if</span> (originalTween.properties[pName] != undefined) {
<span class="lineno" id="578">   578  </span>				originalTween.properties[pName] = undefined;
<span class="lineno" id="579">   579  </span>				<span class="key">delete</span> originalTween.properties[pName];
<span class="lineno" id="580">   580  </span>			}
<span class="lineno" id="581">   581  </span>		}
<span class="lineno" id="582">   582  </span>
<span class="lineno" id="583">   583  </span>		<span class="comment">// Removes the unspecified properties from the new one</span>
<span class="lineno" id="584">   584  </span>		<span class="key">var</span> found:Boolean;
<span class="lineno" id="585">   585  </span>		<span class="key">for</span> (pName <span class="key">in</span> newTween.properties) {
<span class="lineno" id="586">   586  </span>			found = <span class="key">false</span>;
<span class="lineno" id="587">   587  </span>			<span class="key">for</span> (i = <span class="num_const">0</span>; i &lt; p_properties.length; i++) {
<span class="lineno" id="588">   588  </span>				<span class="key">if</span> (p_properties[i] == pName) {
<span class="lineno" id="589">   589  </span>					found = <span class="key">true</span>;
<span class="lineno" id="590">   590  </span>					<span class="key">break</span>;
<span class="lineno" id="591">   591  </span>				}
<span class="lineno" id="592">   592  </span>			}
<span class="lineno" id="593">   593  </span>			<span class="key">if</span> (!found) {
<span class="lineno" id="594">   594  </span>				newTween.properties[pName] = undefined;
<span class="lineno" id="595">   595  </span>				<span class="key">delete</span> newTween.properties[pName];
<span class="lineno" id="596">   596  </span>			}
<span class="lineno" id="597">   597  </span>		}
<span class="lineno" id="598">   598  </span>
<span class="lineno" id="599">   599  </span>		<span class="comment">// If there are empty property lists, a cleanup is done on the next updateTweens() cycle</span>
<span class="lineno" id="600">   600  </span>		_tweenList.push(newTween);
<span class="lineno" id="601">   601  </span>		<span class="key">return</span> (_tweenList.length - <span class="num_const">1</span>);
<span class="lineno" id="602">   602  </span>		
<span class="lineno" id="603">   603  </span>	}
<span class="lineno" id="604">   604  </span>
<span class="lineno" id="605">   605  </span>
<span class="lineno" id="606">   606  </span>	<span class="comment">// ==================================================================================================================================</span>
<span class="lineno" id="607">   607  </span>	<span class="comment">// ENGINE functions -----------------------------------------------------------------------------------------------------------------</span>
<span class="lineno" id="608">   608  </span>
<span class="lineno" id="609">   609  </span>	<span class="comment doc">/**
<span class="lineno" id="610">   610  </span>	 * Updates all existing tweenings
<span class="lineno" id="611">   611  </span>	 *
<span class="lineno" id="612">   612  </span>	 * @return							Boolean		FALSE if no update was made because there's no tweening (even delayed ones)
<span class="lineno" id="613">   613  </span>	 */</span>
<span class="lineno" id="614">   614  </span>	<span class="key">private</span> <span class="key">static</span> <span class="key">function</span> updateTweens ():Boolean {
<span class="lineno" id="615">   615  </span>		<span class="key">if</span> (_tweenList.length == <span class="num_const">0</span>) <span class="key">return</span> <span class="key">false</span>;
<span class="lineno" id="616">   616  </span>		<span class="key">var</span> i:Number;
<span class="lineno" id="617">   617  </span>		<span class="key">for</span> (i = <span class="num_const">0</span>; i &lt; _tweenList.length; i++) {
<span class="lineno" id="618">   618  </span>			<span class="comment">// Looping throught each Tweening and updating the values accordingly</span>
<span class="lineno" id="619">   619  </span>			<span class="key">if</span> (!_tweenList[i].isPaused) {
<span class="lineno" id="620">   620  </span>				<span class="key">if</span> (!updateTweenByIndex(i)) removeTweenByIndex(i);
<span class="lineno" id="621">   621  </span>				<span class="key">if</span> (_tweenList[i] == <span class="key">null</span>) {
<span class="lineno" id="622">   622  </span>					removeTweenByIndex(i, <span class="key">true</span>);
<span class="lineno" id="623">   623  </span>					i--;
<span class="lineno" id="624">   624  </span>				}
<span class="lineno" id="625">   625  </span>			}
<span class="lineno" id="626">   626  </span>		}
<span class="lineno" id="627">   627  </span>
<span class="lineno" id="628">   628  </span>		<span class="key">return</span> <span class="key">true</span>;
<span class="lineno" id="629">   629  </span>	}
<span class="lineno" id="630">   630  </span>
<span class="lineno" id="631">   631  </span>	<span class="comment doc">/**
<span class="lineno" id="632">   632  </span>	 * Remove an specific tweening from the tweening list
<span class="lineno" id="633">   633  </span>	 *
<span class="lineno" id="634">   634  </span>	 * @param		p_tween				Number		Index of the tween to be removed on the tweenings list
<span class="lineno" id="635">   635  </span>	 * @return							Boolean		Whether or not it successfully removed this tweening
<span class="lineno" id="636">   636  </span>	 */</span>
<span class="lineno" id="637">   637  </span>	<span class="key">public</span> <span class="key">static</span> <span class="key">function</span> removeTweenByIndex (p_tween:Number, p_finalRemoval:Boolean):Boolean {
<span class="lineno" id="638">   638  </span>		_tweenList[p_tween] = <span class="key">null</span>;
<span class="lineno" id="639">   639  </span>		<span class="key">if</span> (p_finalRemoval) _tweenList.splice(p_tween, <span class="num_const">1</span>);
<span class="lineno" id="640">   640  </span>		<span class="key">return</span> <span class="key">true</span>;
<span class="lineno" id="641">   641  </span>	}
<span class="lineno" id="642">   642  </span>
<span class="lineno" id="643">   643  </span>	<span class="comment doc">/**
<span class="lineno" id="644">   644  </span>	 * Pauses an specific tween
<span class="lineno" id="645">   645  </span>	 *
<span class="lineno" id="646">   646  </span>	 * @param		p_tween				Number		Index of the tween to be paused
<span class="lineno" id="647">   647  </span>	 * @return							Boolean		Whether or not it successfully paused this tweening
<span class="lineno" id="648">   648  </span>	 */</span>
<span class="lineno" id="649">   649  </span>	<span class="key">public</span> <span class="key">static</span> <span class="key">function</span> pauseTweenByIndex (p_tween:Number):Boolean {
<span class="lineno" id="650">   650  </span>		<span class="key">var</span> tTweening:Object = _tweenList[p_tween];	<span class="comment">// Shortcut to this tweening</span>
<span class="lineno" id="651">   651  </span>		<span class="key">if</span> (tTweening == <span class="key">null</span> || tTweening.isPaused) <span class="key">return</span> <span class="key">false</span>;
<span class="lineno" id="652">   652  </span>		tTweening.timePaused = getCurrentTweeningTime(tTweening);
<span class="lineno" id="653">   653  </span>		tTweening.isPaused = <span class="key">true</span>;
<span class="lineno" id="654">   654  </span>
<span class="lineno" id="655">   655  </span>		<span class="key">return</span> <span class="key">true</span>;
<span class="lineno" id="656">   656  </span>	}
<span class="lineno" id="657">   657  </span>
<span class="lineno" id="658">   658  </span>	<span class="comment doc">/**
<span class="lineno" id="659">   659  </span>	 * Resumes an specific tween
<span class="lineno" id="660">   660  </span>	 *
<span class="lineno" id="661">   661  </span>	 * @param		p_tween				Number		Index of the tween to be resumed
<span class="lineno" id="662">   662  </span>	 * @return							Boolean		Whether or not it successfully resumed this tweening
<span class="lineno" id="663">   663  </span>	 */</span>
<span class="lineno" id="664">   664  </span>	<span class="key">public</span> <span class="key">static</span> <span class="key">function</span> resumeTweenByIndex (p_tween:Number):Boolean {
<span class="lineno" id="665">   665  </span>		<span class="key">var</span> tTweening:Object = _tweenList[p_tween];	<span class="comment">// Shortcut to this tweening</span>
<span class="lineno" id="666">   666  </span>		<span class="key">if</span> (tTweening == <span class="key">null</span> || !tTweening.isPaused) <span class="key">return</span> <span class="key">false</span>;
<span class="lineno" id="667">   667  </span>		<span class="key">var</span> cTime:Number = getCurrentTweeningTime(tTweening);
<span class="lineno" id="668">   668  </span>		tTweening.timeStart += cTime - tTweening.timePaused;
<span class="lineno" id="669">   669  </span>		tTweening.timeComplete += cTime - tTweening.timePaused;
<span class="lineno" id="670">   670  </span>		tTweening.timePaused = undefined;
<span class="lineno" id="671">   671  </span>		tTweening.isPaused = <span class="key">false</span>;
<span class="lineno" id="672">   672  </span>
<span class="lineno" id="673">   673  </span>		<span class="key">return</span> <span class="key">true</span>;
<span class="lineno" id="674">   674  </span>	}
<span class="lineno" id="675">   675  </span>
<span class="lineno" id="676">   676  </span>	<span class="comment doc">/**
<span class="lineno" id="677">   677  </span>	 * Updates an specific tween
<span class="lineno" id="678">   678  </span>	 *
<span class="lineno" id="679">   679  </span>	 * @param		i					Number		Index (from the tween list) of the tween that should be updated
<span class="lineno" id="680">   680  </span>	 * @return							Boolean		FALSE if it's already finished and should be deleted, TRUE if otherwise
<span class="lineno" id="681">   681  </span>	 */</span>
<span class="lineno" id="682">   682  </span>	<span class="key">private</span> <span class="key">static</span> <span class="key">function</span> updateTweenByIndex (i:Number):Boolean {
<span class="lineno" id="683">   683  </span>
<span class="lineno" id="684">   684  </span>		<span class="key">var</span> tTweening:Object = _tweenList[i];	<span class="comment">// Shortcut to this tweening</span>
<span class="lineno" id="685">   685  </span>
<span class="lineno" id="686">   686  </span>		<span class="key">if</span> (tTweening == <span class="key">null</span> || !tTweening.scope) <span class="key">return</span> <span class="key">false</span>;
<span class="lineno" id="687">   687  </span>
<span class="lineno" id="688">   688  </span>		<span class="key">var</span> isOver:Boolean = <span class="key">false</span>;		<span class="comment">// Whether or not it's over the update time</span>
<span class="lineno" id="689">   689  </span>		<span class="key">var</span> mustUpdate:Boolean;			<span class="comment">// Whether or not it should be updated (skipped if false)</span>
<span class="lineno" id="690">   690  </span>
<span class="lineno" id="691">   691  </span>		<span class="key">var</span> nv:Number;					<span class="comment">// New value for each property</span>
<span class="lineno" id="692">   692  </span>
<span class="lineno" id="693">   693  </span>		<span class="key">var</span> t:Number;					<span class="comment">// current time (frames, seconds)</span>
<span class="lineno" id="694">   694  </span>		<span class="key">var</span> b:Number;					<span class="comment">// beginning value</span>
<span class="lineno" id="695">   695  </span>		<span class="key">var</span> c:Number;					<span class="comment">// change in value</span>
<span class="lineno" id="696">   696  </span>		<span class="key">var</span> d:Number; 					<span class="comment">// duration (frames, seconds)</span>
<span class="lineno" id="697">   697  </span>
<span class="lineno" id="698">   698  </span>		<span class="key">var</span> pName:String;				<span class="comment">// Property name, used in loops</span>
<span class="lineno" id="699">   699  </span>		<span class="key">var</span> eventScope:Object;			<span class="comment">// Event scope, used to call functions</span>
<span class="lineno" id="700">   700  </span>
<span class="lineno" id="701">   701  </span>		<span class="comment">// Shortcut stuff for speed</span>
<span class="lineno" id="702">   702  </span>		<span class="key">var</span> tScope:Object;				<span class="comment">// Current scope</span>
<span class="lineno" id="703">   703  </span>		<span class="key">var</span> cTime:Number = getCurrentTweeningTime(tTweening);
<span class="lineno" id="704">   704  </span>		<span class="key">var</span> tProperty:Object;			<span class="comment">// Property being checked</span>
<span class="lineno" id="705">   705  </span>
<span class="lineno" id="706">   706  </span>		<span class="key">if</span> (cTime &gt;= tTweening.timeStart) {
<span class="lineno" id="707">   707  </span>			<span class="comment">// Can already start</span>
<span class="lineno" id="708">   708  </span>
<span class="lineno" id="709">   709  </span>			tScope = tTweening.scope;
<span class="lineno" id="710">   710  </span>
<span class="lineno" id="711">   711  </span>			<span class="key">if</span> (tTweening.isCaller) {
<span class="lineno" id="712">   712  </span>				<span class="comment">// It's a 'caller' tween</span>
<span class="lineno" id="713">   713  </span>				<span class="key">do</span> {
<span class="lineno" id="714">   714  </span>					t = ((tTweening.timeComplete - tTweening.timeStart)/tTweening.count) * (tTweening.timesCalled+<span class="num_const">1</span>);
<span class="lineno" id="715">   715  </span>					b = tTweening.timeStart;
<span class="lineno" id="716">   716  </span>					c = tTweening.timeComplete - tTweening.timeStart;
<span class="lineno" id="717">   717  </span>					d = tTweening.timeComplete - tTweening.timeStart;
<span class="lineno" id="718">   718  </span>					nv = tTweening.transition(t, b, c, d, tTweening.transitionParams);
<span class="lineno" id="719">   719  </span>
<span class="lineno" id="720">   720  </span>					<span class="key">if</span> (cTime &gt;= nv) {
<span class="lineno" id="721">   721  </span>						<span class="key">if</span> (tTweening.onUpdate != undefined) {
<span class="lineno" id="722">   722  </span>							eventScope = tTweening.onUpdateScope != undefined ? tTweening.onUpdateScope : tScope;
<span class="lineno" id="723">   723  </span>							<span class="key">try</span> {
<span class="lineno" id="724">   724  </span>								tTweening.onUpdate.apply(eventScope, tTweening.onUpdateParams);
<span class="lineno" id="725">   725  </span>							} <span class="key">catch</span>(e:Error) {
<span class="lineno" id="726">   726  </span>								handleError(tTweening, e, <span class="str_const">"onUpdate"</span>);
<span class="lineno" id="727">   727  </span>							}
<span class="lineno" id="728">   728  </span>						}
<span class="lineno" id="729">   729  </span>
<span class="lineno" id="730">   730  </span>						tTweening.timesCalled++;
<span class="lineno" id="731">   731  </span>						<span class="key">if</span> (tTweening.timesCalled &gt;= tTweening.count) {
<span class="lineno" id="732">   732  </span>							isOver = <span class="key">true</span>;
<span class="lineno" id="733">   733  </span>							<span class="key">break</span>;
<span class="lineno" id="734">   734  </span>						}
<span class="lineno" id="735">   735  </span>						<span class="key">if</span> (tTweening.waitFrames) <span class="key">break</span>;
<span class="lineno" id="736">   736  </span>					}
<span class="lineno" id="737">   737  </span>
<span class="lineno" id="738">   738  </span>				} <span class="key">while</span> (cTime &gt;= nv);
<span class="lineno" id="739">   739  </span>			} <span class="key">else</span> {
<span class="lineno" id="740">   740  </span>				<span class="comment">// It's a normal transition tween</span>
<span class="lineno" id="741">   741  </span>
<span class="lineno" id="742">   742  </span>				mustUpdate = tTweening.skipUpdates &lt; <span class="num_const">1</span> || tTweening.skipUpdates == undefined || tTweening.updatesSkipped &gt;= tTweening.skipUpdates;
<span class="lineno" id="743">   743  </span>
<span class="lineno" id="744">   744  </span>				<span class="key">if</span> (cTime &gt;= tTweening.timeComplete) {
<span class="lineno" id="745">   745  </span>					isOver = <span class="key">true</span>;
<span class="lineno" id="746">   746  </span>					mustUpdate = <span class="key">true</span>;
<span class="lineno" id="747">   747  </span>				}
<span class="lineno" id="748">   748  </span>
<span class="lineno" id="749">   749  </span>				<span class="key">if</span> (!tTweening.hasStarted) {
<span class="lineno" id="750">   750  </span>					<span class="comment">// First update, read all default values (for proper filter tweening)</span>
<span class="lineno" id="751">   751  </span>					<span class="key">if</span> (tTweening.onStart != undefined) {
<span class="lineno" id="752">   752  </span>						eventScope = tTweening.onStartScope != undefined ? tTweening.onStartScope : tScope;
<span class="lineno" id="753">   753  </span>						<span class="key">try</span> {
<span class="lineno" id="754">   754  </span>							tTweening.onStart.apply(eventScope, tTweening.onStartParams);
<span class="lineno" id="755">   755  </span>						} <span class="key">catch</span>(e:Error) {
<span class="lineno" id="756">   756  </span>							handleError(tTweening, e, <span class="str_const">"onStart"</span>);
<span class="lineno" id="757">   757  </span>						}
<span class="lineno" id="758">   758  </span>					}
<span class="lineno" id="759">   759  </span>					<span class="key">var</span> pv:Number;
<span class="lineno" id="760">   760  </span>					<span class="key">for</span> (pName <span class="key">in</span> tTweening.properties) {
<span class="lineno" id="761">   761  </span>						<span class="key">if</span> (tTweening.properties[pName].isSpecialProperty) {
<span class="lineno" id="762">   762  </span>							<span class="comment">// It's a special property, tunnel via the special property function</span>
<span class="lineno" id="763">   763  </span>							<span class="key">if</span> (_specialPropertyList[pName].preProcess != undefined) {
<span class="lineno" id="764">   764  </span>								tTweening.properties[pName].valueComplete = _specialPropertyList[pName].preProcess(tScope, _specialPropertyList[pName].parameters, tTweening.properties[pName].originalValueComplete, tTweening.properties[pName].extra);
<span class="lineno" id="765">   765  </span>							}
<span class="lineno" id="766">   766  </span>							pv = _specialPropertyList[pName].getValue(tScope, _specialPropertyList[pName].parameters, tTweening.properties[pName].extra);
<span class="lineno" id="767">   767  </span>						} <span class="key">else</span> {
<span class="lineno" id="768">   768  </span>							<span class="comment">// Directly read property</span>
<span class="lineno" id="769">   769  </span>							pv = tScope[pName];
<span class="lineno" id="770">   770  </span>						}
<span class="lineno" id="771">   771  </span>						tTweening.properties[pName].valueStart = isNaN(pv) ? tTweening.properties[pName].valueComplete : pv;
<span class="lineno" id="772">   772  </span>					}
<span class="lineno" id="773">   773  </span>					mustUpdate = <span class="key">true</span>;
<span class="lineno" id="774">   774  </span>					tTweening.hasStarted = <span class="key">true</span>;
<span class="lineno" id="775">   775  </span>				}
<span class="lineno" id="776">   776  </span>
<span class="lineno" id="777">   777  </span>				<span class="key">if</span> (mustUpdate) {
<span class="lineno" id="778">   778  </span>					<span class="key">for</span> (pName <span class="key">in</span> tTweening.properties) {
<span class="lineno" id="779">   779  </span>						tProperty = tTweening.properties[pName];
<span class="lineno" id="780">   780  </span>
<span class="lineno" id="781">   781  </span>						<span class="key">if</span> (isOver) {
<span class="lineno" id="782">   782  </span>							<span class="comment">// Tweening time has finished, just set it to the final value</span>
<span class="lineno" id="783">   783  </span>							nv = tProperty.valueComplete;
<span class="lineno" id="784">   784  </span>						} <span class="key">else</span> {
<span class="lineno" id="785">   785  </span>							<span class="key">if</span> (tProperty.hasModifier) {
<span class="lineno" id="786">   786  </span>								<span class="comment">// Modified</span>
<span class="lineno" id="787">   787  </span>								t = cTime - tTweening.timeStart;
<span class="lineno" id="788">   788  </span>								d = tTweening.timeComplete - tTweening.timeStart;
<span class="lineno" id="789">   789  </span>								nv = tTweening.transition(t, <span class="num_const">0</span>, <span class="num_const">1</span>, d, tTweening.transitionParams);
<span class="lineno" id="790">   790  </span>								nv = tProperty.modifierFunction(tProperty.valueStart, tProperty.valueComplete, nv, tProperty.modifierParameters);
<span class="lineno" id="791">   791  </span>							} <span class="key">else</span> {
<span class="lineno" id="792">   792  </span>								<span class="comment">// Normal update</span>
<span class="lineno" id="793">   793  </span>								t = cTime - tTweening.timeStart;
<span class="lineno" id="794">   794  </span>								b = tProperty.valueStart;
<span class="lineno" id="795">   795  </span>								c = tProperty.valueComplete - tProperty.valueStart;
<span class="lineno" id="796">   796  </span>								d = tTweening.timeComplete - tTweening.timeStart;
<span class="lineno" id="797">   797  </span>								nv = tTweening.transition(t, b, c, d, tTweening.transitionParams);
<span class="lineno" id="798">   798  </span>							}
<span class="lineno" id="799">   799  </span>						}
<span class="lineno" id="800">   800  </span>
<span class="lineno" id="801">   801  </span>						<span class="key">if</span> (tTweening.rounded) nv = Math.round(nv);
<span class="lineno" id="802">   802  </span>						<span class="key">if</span> (tProperty.isSpecialProperty) {
<span class="lineno" id="803">   803  </span>							<span class="comment">// It's a special property, tunnel via the special property method</span>
<span class="lineno" id="804">   804  </span>							_specialPropertyList[pName].setValue(tScope, nv, _specialPropertyList[pName].parameters, tTweening.properties[pName].extra);
<span class="lineno" id="805">   805  </span>						} <span class="key">else</span> {
<span class="lineno" id="806">   806  </span>							<span class="comment">// Directly set property</span>
<span class="lineno" id="807">   807  </span>							tScope[pName] = nv;
<span class="lineno" id="808">   808  </span>						}
<span class="lineno" id="809">   809  </span>					}
<span class="lineno" id="810">   810  </span>
<span class="lineno" id="811">   811  </span>					tTweening.updatesSkipped = <span class="num_const">0</span>;
<span class="lineno" id="812">   812  </span>
<span class="lineno" id="813">   813  </span>					<span class="key">if</span> (tTweening.onUpdate != undefined) {
<span class="lineno" id="814">   814  </span>						eventScope = tTweening.onUpdateScope != undefined ? tTweening.onUpdateScope : tScope;
<span class="lineno" id="815">   815  </span>						<span class="key">try</span> {
<span class="lineno" id="816">   816  </span>							tTweening.onUpdate.apply(eventScope, tTweening.onUpdateParams);
<span class="lineno" id="817">   817  </span>						} <span class="key">catch</span>(e:Error) {
<span class="lineno" id="818">   818  </span>							handleError(tTweening, e, <span class="str_const">"onUpdate"</span>);
<span class="lineno" id="819">   819  </span>						}
<span class="lineno" id="820">   820  </span>					}
<span class="lineno" id="821">   821  </span>				} <span class="key">else</span> {
<span class="lineno" id="822">   822  </span>					tTweening.updatesSkipped++;
<span class="lineno" id="823">   823  </span>				}
<span class="lineno" id="824">   824  </span>			}
<span class="lineno" id="825">   825  </span>
<span class="lineno" id="826">   826  </span>			<span class="key">if</span> (isOver &amp;&amp; tTweening.onComplete != undefined) {
<span class="lineno" id="827">   827  </span>				eventScope = tTweening.onCompleteScope != undefined ? tTweening.onCompleteScope : tScope;
<span class="lineno" id="828">   828  </span>				<span class="key">try</span> {
<span class="lineno" id="829">   829  </span>					tTweening.onComplete.apply(eventScope, tTweening.onCompleteParams);
<span class="lineno" id="830">   830  </span>				} <span class="key">catch</span>(e:Error) {
<span class="lineno" id="831">   831  </span>					handleError(tTweening, e, <span class="str_const">"onComplete"</span>);
<span class="lineno" id="832">   832  </span>				}
<span class="lineno" id="833">   833  </span>			}
<span class="lineno" id="834">   834  </span>
<span class="lineno" id="835">   835  </span>			<span class="key">return</span> (!isOver);
<span class="lineno" id="836">   836  </span>		}
<span class="lineno" id="837">   837  </span>
<span class="lineno" id="838">   838  </span>		<span class="comment">// On delay, hasn't started, so return true</span>
<span class="lineno" id="839">   839  </span>		<span class="key">return</span> (<span class="key">true</span>);
<span class="lineno" id="840">   840  </span>
<span class="lineno" id="841">   841  </span>	}
<span class="lineno" id="842">   842  </span>
<span class="lineno" id="843">   843  </span>	<span class="comment doc">/**
<span class="lineno" id="844">   844  </span>	 * Initiates the Tweener. Should only be ran once
<span class="lineno" id="845">   845  </span>	 */</span>
<span class="lineno" id="846">   846  </span>	<span class="key">private</span> <span class="key">static</span> <span class="key">function</span> init():Void {
<span class="lineno" id="847">   847  </span>		_inited = <span class="key">true</span>;
<span class="lineno" id="848">   848  </span>
<span class="lineno" id="849">   849  </span>		<span class="comment">// Registers all default equations</span>
<span class="lineno" id="850">   850  </span>		_transitionList = <span class="key">new</span> Object();
<span class="lineno" id="851">   851  </span>		Equations.init();
<span class="lineno" id="852">   852  </span>
<span class="lineno" id="853">   853  </span>		<span class="comment">// Registers all default special properties</span>
<span class="lineno" id="854">   854  </span>		_specialPropertyList = <span class="key">new</span> Object();
<span class="lineno" id="855">   855  </span>		_specialPropertyModifierList = <span class="key">new</span> Object();
<span class="lineno" id="856">   856  </span>		_specialPropertySplitterList = <span class="key">new</span> Object();
<span class="lineno" id="857">   857  </span>	}
<span class="lineno" id="858">   858  </span>
<span class="lineno" id="859">   859  </span>	<span class="comment doc">/**
<span class="lineno" id="860">   860  </span>	 * Adds a new function to the available transition list "shortcuts"
<span class="lineno" id="861">   861  </span>	 *
<span class="lineno" id="862">   862  </span>	 * @param		p_name				String		Shorthand transition name
<span class="lineno" id="863">   863  </span>	 * @param		p_function			Function	The proper equation function
<span class="lineno" id="864">   864  </span>	 */</span>
<span class="lineno" id="865">   865  </span>	<span class="key">public</span> <span class="key">static</span> <span class="key">function</span> registerTransition(p_name:String, p_function:Function): Void {
<span class="lineno" id="866">   866  </span>		<span class="key">if</span> (!_inited) init();
<span class="lineno" id="867">   867  </span>		_transitionList[p_name] = p_function;
<span class="lineno" id="868">   868  </span>	}
<span class="lineno" id="869">   869  </span>
<span class="lineno" id="870">   870  </span>	<span class="comment doc">/**
<span class="lineno" id="871">   871  </span>	 * Adds a new special property to the available special property list.
<span class="lineno" id="872">   872  </span>	 *
<span class="lineno" id="873">   873  </span>	 * @param		p_name				Name of the "special" property.
<span class="lineno" id="874">   874  </span>	 * @param		p_getFunction		Function that gets the value.
<span class="lineno" id="875">   875  </span>	 * @param		p_setFunction		Function that sets the value.
<span class="lineno" id="876">   876  </span>	 */</span>
<span class="lineno" id="877">   877  </span>	<span class="key">public</span> <span class="key">static</span> <span class="key">function</span> registerSpecialProperty(p_name:String, p_getFunction:Function, p_setFunction:Function, p_parameters:Array, p_preProcessFunction:Function): Void {
<span class="lineno" id="878">   878  </span>		<span class="key">if</span> (!_inited) init();
<span class="lineno" id="879">   879  </span>		<span class="key">var</span> sp:SpecialProperty = <span class="key">new</span> SpecialProperty(p_getFunction, p_setFunction, p_parameters, p_preProcessFunction);
<span class="lineno" id="880">   880  </span>		_specialPropertyList[p_name] = sp;
<span class="lineno" id="881">   881  </span>	}
<span class="lineno" id="882">   882  </span>
<span class="lineno" id="883">   883  </span>	<span class="comment doc">/**
<span class="lineno" id="884">   884  </span>	 * Adds a new special property modifier to the available modifier list.
<span class="lineno" id="885">   885  </span>	 *
<span class="lineno" id="886">   886  </span>	 * @param		p_name				Name of the "special" property modifier.
<span class="lineno" id="887">   887  </span>	 * @param		p_modifyFunction	Function that modifies the value.
<span class="lineno" id="888">   888  </span>	 * @param		p_getFunction		Function that gets the value.
<span class="lineno" id="889">   889  </span>	 */</span>
<span class="lineno" id="890">   890  </span>	<span class="key">public</span> <span class="key">static</span> <span class="key">function</span> registerSpecialPropertyModifier(p_name:String, p_modifyFunction:Function, p_getFunction:Function): Void {
<span class="lineno" id="891">   891  </span>		<span class="key">if</span> (!_inited) init();
<span class="lineno" id="892">   892  </span>		<span class="key">var</span> spm:SpecialPropertyModifier = <span class="key">new</span> SpecialPropertyModifier(p_modifyFunction, p_getFunction);
<span class="lineno" id="893">   893  </span>		_specialPropertyModifierList[p_name] = spm;
<span class="lineno" id="894">   894  </span>	}
<span class="lineno" id="895">   895  </span>
<span class="lineno" id="896">   896  </span>	<span class="comment doc">/**
<span class="lineno" id="897">   897  </span>	 * Adds a new special property splitter to the available splitter list.
<span class="lineno" id="898">   898  </span>	 *
<span class="lineno" id="899">   899  </span>	 * @param		p_name				Name of the "special" property splitter.
<span class="lineno" id="900">   900  </span>	 * @param		p_splitFunction		Function that splits the value.
<span class="lineno" id="901">   901  </span>	 */</span>
<span class="lineno" id="902">   902  </span>	<span class="key">public</span> <span class="key">static</span> <span class="key">function</span> registerSpecialPropertySplitter(p_name:String, p_splitFunction:Function, p_parameters:Array): Void {
<span class="lineno" id="903">   903  </span>		<span class="key">if</span> (!_inited) init();
<span class="lineno" id="904">   904  </span>		<span class="key">var</span> sps:SpecialPropertySplitter = <span class="key">new</span> SpecialPropertySplitter(p_splitFunction, p_parameters);
<span class="lineno" id="905">   905  </span>		_specialPropertySplitterList[p_name] = sps;
<span class="lineno" id="906">   906  </span>	}
<span class="lineno" id="907">   907  </span>
<span class="lineno" id="908">   908  </span>	<span class="comment doc">/**
<span class="lineno" id="909">   909  </span>	 * Starts the Tweener class engine. It is supposed to be running every time a tween exists
<span class="lineno" id="910">   910  </span>	 */</span>
<span class="lineno" id="911">   911  </span>	<span class="key">private</span> <span class="key">static</span> <span class="key">function</span> startEngine():Void {
<span class="lineno" id="912">   912  </span>		_engineExists = <span class="key">true</span>;
<span class="lineno" id="913">   913  </span>		_tweenList = <span class="key">new</span> Array();
<span class="lineno" id="914">   914  </span>
<span class="lineno" id="915">   915  </span>		<span class="key">var</span> randomDepth:Number = Math.floor(Math.random() * <span class="num_const">999999</span>);
<span class="lineno" id="916">   916  </span>		<span class="key">var</span> fmc:MovieClip = _root.createEmptyMovieClip(getControllerName(), <span class="num_const">31338</span>+randomDepth);
<span class="lineno" id="917">   917  </span>		fmc.onEnterFrame = <span class="key">function</span>(): Void {
<span class="lineno" id="918">   918  </span>			Tweener.onEnterFrame();
<span class="lineno" id="919">   919  </span>		};
<span class="lineno" id="920">   920  </span>
<span class="lineno" id="921">   921  </span>		_currentTimeFrame = <span class="num_const">0</span>;
<span class="lineno" id="922">   922  </span>		updateTime();
<span class="lineno" id="923">   923  </span>	}
<span class="lineno" id="924">   924  </span>
<span class="lineno" id="925">   925  </span>	<span class="comment doc">/**
<span class="lineno" id="926">   926  </span>	 * Stops the Tweener class engine
<span class="lineno" id="927">   927  </span>	 */</span>
<span class="lineno" id="928">   928  </span>	<span class="key">private</span> <span class="key">static</span> <span class="key">function</span> stopEngine():Void {
<span class="lineno" id="929">   929  </span>		_engineExists = <span class="key">false</span>;
<span class="lineno" id="930">   930  </span>		_tweenList = <span class="key">null</span>;
<span class="lineno" id="931">   931  </span>		_currentTime = <span class="num_const">0</span>;
<span class="lineno" id="932">   932  </span>		_currentTimeFrame = <span class="num_const">0</span>;
<span class="lineno" id="933">   933  </span>		<span class="key">delete</span> _root[getControllerName()].onEnterFrame;
<span class="lineno" id="934">   934  </span>		_root[getControllerName()].removeMovieClip();
<span class="lineno" id="935">   935  </span>	}
<span class="lineno" id="936">   936  </span>
<span class="lineno" id="937">   937  </span>	<span class="comment doc">/**
<span class="lineno" id="938">   938  </span>	 * Updates the time to enforce time grid-based updates
<span class="lineno" id="939">   939  </span>	 */</span>
<span class="lineno" id="940">   940  </span>	<span class="key">public</span> <span class="key">static</span> <span class="key">function</span> updateTime():Void {
<span class="lineno" id="941">   941  </span>		_currentTime = getTimer();
<span class="lineno" id="942">   942  </span>	}
<span class="lineno" id="943">   943  </span>
<span class="lineno" id="944">   944  </span>	<span class="comment doc">/**
<span class="lineno" id="945">   945  </span>	 * Updates the current frame count
<span class="lineno" id="946">   946  </span>	 */</span>
<span class="lineno" id="947">   947  </span>	<span class="key">public</span> <span class="key">static</span> <span class="key">function</span> updateFrame():Void {
<span class="lineno" id="948">   948  </span>		_currentTimeFrame++;
<span class="lineno" id="949">   949  </span>	}
<span class="lineno" id="950">   950  </span>
<span class="lineno" id="951">   951  </span>	<span class="comment doc">/**
<span class="lineno" id="952">   952  </span>	 * Ran once every frame. It's the main engine, updates all existing tweenings.
<span class="lineno" id="953">   953  </span>	 */</span>
<span class="lineno" id="954">   954  </span>	<span class="key">public</span> <span class="key">static</span> <span class="key">function</span> onEnterFrame():Void {
<span class="lineno" id="955">   955  </span>		updateTime();
<span class="lineno" id="956">   956  </span>		updateFrame();
<span class="lineno" id="957">   957  </span>		<span class="key">var</span> hasUpdated:Boolean = <span class="key">false</span>;
<span class="lineno" id="958">   958  </span>		hasUpdated = updateTweens();
<span class="lineno" id="959">   959  </span>		<span class="key">if</span> (!hasUpdated) stopEngine();	<span class="comment">// There's no tweening to update or wait, so it's better to stop the engine</span>
<span class="lineno" id="960">   960  </span>	}
<span class="lineno" id="961">   961  </span>
<span class="lineno" id="962">   962  </span>	<span class="comment doc">/**
<span class="lineno" id="963">   963  </span>	 * Sets the new time scale.
<span class="lineno" id="964">   964  </span>	 *
<span class="lineno" id="965">   965  </span>	 * @param		p_time				Number		New time scale (0.5 = slow, 1 = normal, 2 = 2x fast forward, etc)
<span class="lineno" id="966">   966  </span>	 */</span>
<span class="lineno" id="967">   967  </span>	<span class="key">public</span> <span class="key">static</span> <span class="key">function</span> setTimeScale(p_time:Number):Void {
<span class="lineno" id="968">   968  </span>		<span class="key">var</span> i:Number;
<span class="lineno" id="969">   969  </span>		<span class="key">var</span> cTime:Number;
<span class="lineno" id="970">   970  </span>
<span class="lineno" id="971">   971  </span>		<span class="key">if</span> (isNaN(p_time)) p_time = <span class="num_const">1</span>;
<span class="lineno" id="972">   972  </span>		<span class="key">if</span> (p_time &lt; <span class="num_const">0</span>.<span class="num_const">00001</span>) p_time = <span class="num_const">0</span>.<span class="num_const">00001</span>;
<span class="lineno" id="973">   973  </span>		<span class="key">if</span> (p_time != _timeScale) {
<span class="lineno" id="974">   974  </span>			<span class="comment">// Multiplies all existing tween times accordingly</span>
<span class="lineno" id="975">   975  </span>			<span class="key">for</span> (i = <span class="num_const">0</span>; i&lt;_tweenList.length; i++) {
<span class="lineno" id="976">   976  </span>				cTime = getCurrentTweeningTime(_tweenList[i]);
<span class="lineno" id="977">   977  </span>				_tweenList[i].timeStart = cTime - ((cTime - _tweenList[i].timeStart) * _timeScale / p_time);
<span class="lineno" id="978">   978  </span>				_tweenList[i].timeComplete = cTime - ((cTime - _tweenList[i].timeComplete) * _timeScale / p_time);
<span class="lineno" id="979">   979  </span>				<span class="key">if</span> (_tweenList[i].timePaused != undefined) _tweenList[i].timePaused = cTime - ((cTime - _tweenList[i].timePaused) * _timeScale / p_time);
<span class="lineno" id="980">   980  </span>			}
<span class="lineno" id="981">   981  </span>			<span class="comment">// Sets the new timescale value (for new tweenings)</span>
<span class="lineno" id="982">   982  </span>			_timeScale = p_time;
<span class="lineno" id="983">   983  </span>		}
<span class="lineno" id="984">   984  </span>	}
<span class="lineno" id="985">   985  </span>
<span class="lineno" id="986">   986  </span>	<span class="comment">// ==================================================================================================================================</span>
<span class="lineno" id="987">   987  </span>	<span class="comment">// AUXILIARY functions --------------------------------------------------------------------------------------------------------------</span>
<span class="lineno" id="988">   988  </span>
<span class="lineno" id="989">   989  </span>	<span class="comment doc">/**
<span class="lineno" id="990">   990  </span>	 * Finds whether or not an object has any tweening
<span class="lineno" id="991">   991  </span>	 *
<span class="lineno" id="992">   992  </span>	 * @param		p_scope				Object		Target object
<span class="lineno" id="993">   993  </span>	 * @return							Boolean		Whether or not there's a tweening occuring on this object (paused, delayed, or active)
<span class="lineno" id="994">   994  </span>	 */</span>
<span class="lineno" id="995">   995  </span>	<span class="key">public</span> <span class="key">static</span> <span class="key">function</span> isTweening(p_scope:Object):Boolean {
<span class="lineno" id="996">   996  </span>        <span class="key">var</span> i:Number;
<span class="lineno" id="997">   997  </span>
<span class="lineno" id="998">   998  </span>        <span class="key">for</span> (i = <span class="num_const">0</span>; i&lt;_tweenList.length; i++) {
<span class="lineno" id="999">   999  </span>            <span class="key">if</span> (_tweenList[i].scope == p_scope) {
<span class="lineno" id="1000">  1000  </span>                <span class="key">return</span> <span class="key">true</span>;
<span class="lineno" id="1001">  1001  </span>            }
<span class="lineno" id="1002">  1002  </span>        }
<span class="lineno" id="1003">  1003  </span>        <span class="key">return</span> <span class="key">false</span>;
<span class="lineno" id="1004">  1004  </span>    }
<span class="lineno" id="1005">  1005  </span>
<span class="lineno" id="1006">  1006  </span>	<span class="comment doc">/**
<span class="lineno" id="1007">  1007  </span>	 * Return an array containing a list of the properties being tweened for this object
<span class="lineno" id="1008">  1008  </span>	 *
<span class="lineno" id="1009">  1009  </span>	 * @param		p_scope				Object		Target object
<span class="lineno" id="1010">  1010  </span>	 * @return							Array		List of strings with properties being tweened (including delayed or paused)
<span class="lineno" id="1011">  1011  </span>	 */</span>
<span class="lineno" id="1012">  1012  </span>	<span class="key">public</span> <span class="key">static</span> <span class="key">function</span> getTweens(p_scope:Object):Array {
<span class="lineno" id="1013">  1013  </span>        <span class="key">var</span> i:Number;
<span class="lineno" id="1014">  1014  </span>		<span class="key">var</span> pName:String;
<span class="lineno" id="1015">  1015  </span>        <span class="key">var</span> tList:Array = <span class="key">new</span> Array();
<span class="lineno" id="1016">  1016  </span>
<span class="lineno" id="1017">  1017  </span>        <span class="key">for</span> (i = <span class="num_const">0</span>; i&lt;_tweenList.length; i++) {
<span class="lineno" id="1018">  1018  </span>            <span class="key">if</span> (_tweenList[i].scope == p_scope) {
<span class="lineno" id="1019">  1019  </span>				<span class="key">for</span> (pName <span class="key">in</span> _tweenList[i].properties) tList.push(pName);
<span class="lineno" id="1020">  1020  </span>            }
<span class="lineno" id="1021">  1021  </span>        }
<span class="lineno" id="1022">  1022  </span>		<span class="key">return</span> tList;
<span class="lineno" id="1023">  1023  </span>    }
<span class="lineno" id="1024">  1024  </span>
<span class="lineno" id="1025">  1025  </span>	<span class="comment doc">/**
<span class="lineno" id="1026">  1026  </span>	 * Return the number of properties being tweened for this object
<span class="lineno" id="1027">  1027  </span>	 *
<span class="lineno" id="1028">  1028  </span>	 * @param		p_scope				Object		Target object
<span class="lineno" id="1029">  1029  </span>	 * @return							Number		Total count of properties being tweened (including delayed or paused)
<span class="lineno" id="1030">  1030  </span>	 */</span>
<span class="lineno" id="1031">  1031  </span>	<span class="key">public</span> <span class="key">static</span> <span class="key">function</span> getTweenCount(p_scope:Object):Number {
<span class="lineno" id="1032">  1032  </span>        <span class="key">var</span> i:Number;
<span class="lineno" id="1033">  1033  </span>		<span class="key">var</span> c:Number = <span class="num_const">0</span>;
<span class="lineno" id="1034">  1034  </span>
<span class="lineno" id="1035">  1035  </span>        <span class="key">for</span> (i = <span class="num_const">0</span>; i&lt;_tweenList.length; i++) {
<span class="lineno" id="1036">  1036  </span>            <span class="key">if</span> (_tweenList[i].scope == p_scope) {
<span class="lineno" id="1037">  1037  </span>				c += AuxFunctions.getObjectLength(_tweenList[i].properties);
<span class="lineno" id="1038">  1038  </span>            }
<span class="lineno" id="1039">  1039  </span>        }
<span class="lineno" id="1040">  1040  </span>		<span class="key">return</span> c;
<span class="lineno" id="1041">  1041  </span>    }
<span class="lineno" id="1042">  1042  </span>
<span class="lineno" id="1043">  1043  </span>    <span class="comment">/* Handles errors when Tweener executes any callbacks (onStart, onUpdate, etc)
<span class="lineno" id="1044">  1044  </span>    *  If the TweenListObj specifies an &lt;code&gt;onError&lt;/code&gt; callback it well get called, passing the &lt;code&gt;Error&lt;/code&gt; object and the current scope as parameters. If no &lt;code&gt;onError&lt;/code&gt; callback is specified, it will trace a stackTrace.
<span class="lineno" id="1045">  1045  </span>    */</span>
<span class="lineno" id="1046">  1046  </span>    <span class="key">private</span> <span class="key">static</span> <span class="key">function</span> handleError(pTweening : Object, pError : Error, pCallBackName : String) : Void{
<span class="lineno" id="1047">  1047  </span>        <span class="comment">// do we have an error handler?</span>
<span class="lineno" id="1048">  1048  </span>        <span class="key">if</span> (pTweening.onError != undefined &amp;&amp; <span class="key">typeof</span>(pTweening.onError == <span class="str_const">"function"</span>)){
<span class="lineno" id="1049">  1049  </span>            <span class="comment">// yup, there's a handler. Wrap this in a try catch in case the onError throws an error itself.</span>
<span class="lineno" id="1050">  1050  </span>			<span class="key">var</span> eventScope:Object = pTweening.onErrorScope != undefined ? pTweening.onErrorScope : pTweening.scope;
<span class="lineno" id="1051">  1051  </span>            <span class="key">try</span> {
<span class="lineno" id="1052">  1052  </span>                pTweening.onError.apply(eventScope, [pTweening.scope, pError]);
<span class="lineno" id="1053">  1053  </span>            } <span class="key">catch</span> (metaError : Error){
<span class="lineno" id="1054">  1054  </span>				printError(pTweening.scope.toString() + <span class="str_const">" raised an error while executing the 'onError' handler. Original error:\n "</span> + pError +  <span class="str_const">"\nonError error: "</span> + metaError);
<span class="lineno" id="1055">  1055  </span>            }
<span class="lineno" id="1056">  1056  </span>        } <span class="key">else</span> {
<span class="lineno" id="1057">  1057  </span>            <span class="comment">// if handler is undefied or null trace the error message (allows empty onErro's to ignore errors)</span>
<span class="lineno" id="1058">  1058  </span>            <span class="key">if</span> (pTweening.onError == undefined){
<span class="lineno" id="1059">  1059  </span>				printError(pTweening.scope.toString() + <span class="str_const">" raised an error while executing the '"</span> + pCallBackName.toString() + <span class="str_const">"'handler. \n"</span> + pError );
<span class="lineno" id="1060">  1060  </span>            }
<span class="lineno" id="1061">  1061  </span>        }
<span class="lineno" id="1062">  1062  </span>    }
<span class="lineno" id="1063">  1063  </span>
<span class="lineno" id="1064">  1064  </span>	<span class="comment doc">/**
<span class="lineno" id="1065">  1065  </span>	 * Get the current tweening time (no matter if it uses frames or time as basis), given a specific tweening
<span class="lineno" id="1066">  1066  </span>	 *
<span class="lineno" id="1067">  1067  </span>	 * @param		p_tweening				TweenListObj		Tween information
<span class="lineno" id="1068">  1068  </span>	 */</span>
<span class="lineno" id="1069">  1069  </span>	<span class="key">public</span> <span class="key">static</span> <span class="key">function</span> getCurrentTweeningTime(p_tweening:Object):Number {
<span class="lineno" id="1070">  1070  </span>		<span class="key">return</span> p_tweening.useFrames ? _currentTimeFrame : _currentTime;
<span class="lineno" id="1071">  1071  </span>	}
<span class="lineno" id="1072">  1072  </span>
<span class="lineno" id="1073">  1073  </span>	<span class="comment doc">/**
<span class="lineno" id="1074">  1074  </span>	 * Return the current tweener version
<span class="lineno" id="1075">  1075  </span>	 *
<span class="lineno" id="1076">  1076  </span>	 * @return							String		The number of the current Tweener version
<span class="lineno" id="1077">  1077  </span>	 */</span>
<span class="lineno" id="1078">  1078  </span>	<span class="key">public</span> <span class="key">static</span> <span class="key">function</span> getVersion():String {
<span class="lineno" id="1079">  1079  </span>		<span class="key">return</span> <span class="str_const">"AS2 1.31.69"</span>;
<span class="lineno" id="1080">  1080  </span>    }
<span class="lineno" id="1081">  1081  </span>
<span class="lineno" id="1082">  1082  </span>	<span class="comment doc">/**
<span class="lineno" id="1083">  1083  </span>	 * Return the name for the controller movieclip
<span class="lineno" id="1084">  1084  </span>	 *
<span class="lineno" id="1085">  1085  </span>	 * @return							String		The number of the current Tweener version
<span class="lineno" id="1086">  1086  </span>	 */</span>
<span class="lineno" id="1087">  1087  </span>	<span class="key">public</span> <span class="key">static</span> <span class="key">function</span> getControllerName():String {
<span class="lineno" id="1088">  1088  </span>		<span class="key">return</span> <span class="str_const">"__tweener_controller__"</span>+Tweener.getVersion();
<span class="lineno" id="1089">  1089  </span>    }
<span class="lineno" id="1090">  1090  </span>
<span class="lineno" id="1091">  1091  </span>
<span class="lineno" id="1092">  1092  </span>
<span class="lineno" id="1093">  1093  </span>	<span class="comment">// ==================================================================================================================================</span>
<span class="lineno" id="1094">  1094  </span>	<span class="comment">// DEBUG functions ------------------------------------------------------------------------------------------------------------------</span>
<span class="lineno" id="1095">  1095  </span>
<span class="lineno" id="1096">  1096  </span>	<span class="comment doc">/**
<span class="lineno" id="1097">  1097  </span>	 * Output an error message
<span class="lineno" id="1098">  1098  </span>	 *
<span class="lineno" id="1099">  1099  </span>	 * @param		p_message				String		The error message to output
<span class="lineno" id="1100">  1100  </span>	 */</span>
<span class="lineno" id="1101">  1101  </span>	<span class="key">public</span> <span class="key">static</span> <span class="key">function</span> printError(p_message:String): Void {
<span class="lineno" id="1102">  1102  </span>		<span class="comment">//</span>
<span class="lineno" id="1103">  1103  </span>		trace(<span class="str_const">"## [Tweener] Error: "</span>+p_message);
<span class="lineno" id="1104">  1104  </span>	}
<span class="lineno" id="1105">  1105  </span>
<span class="lineno" id="1106">  1106  </span>}
<span class="lineno" id="1107">  1107  </span></pre><ul class="main_nav" id="main_nav"><li><a href="../../overview-summary.html" title="Overview of SASAPI" class="button">Overview</a></li><li><a href="package-summary.html" title="Overview of package caurina.transitions" class="button">Package</a></li><li><a href="Tweener.html" title="Detail of caurina.transitions.Tweener API" class="button">Class</a></li><li><span class="button nav_current">Source</span></li><li><a href="../../index-files/index.html" title="Alpabetical index of types and members" class="button">Index</a></li></ul><div class="footer"><a href="http://www.badgers-in-foil.co.uk/projects/as2api/" title="ActionScript 2 API Documentation Generator">as2api</a></div></body></html>